Commits Jakub Adamek patch that improves logging and fixes reaction on InterruptedException.

This commit is contained in:
paweldomas 2013-11-21 19:02:25 +00:00
parent 9964e3f296
commit 1071e0890c

View File

@ -225,17 +225,18 @@ class StunClientTransaction
if(cancelled) if(cancelled)
return; return;
int curWaitInterval = nextWaitInterval;
if(nextWaitInterval < maxWaitInterval) if(nextWaitInterval < maxWaitInterval)
nextWaitInterval *= 2; nextWaitInterval *= 2;
try try
{ {
logger.fine("retrying transmission of STUN test" logger.fine("retrying STUN "
+ " tid " + transactionID + " tid " + transactionID
+ " from " + localAddress + " from " + localAddress
+ " to " + requestDestination + " to " + requestDestination
+ " nextWait " + nextWaitInterval + " waited " + curWaitInterval
+ " retrans " + (retransmissionCounter+1) + " ms retrans " + (retransmissionCounter+1)
+ " of " + maxRetransmissions); + " of " + maxRetransmissions);
sendRequest0(); sendRequest0();
} }
@ -279,6 +280,10 @@ class StunClientTransaction
void sendRequest() void sendRequest()
throws IllegalArgumentException, IOException throws IllegalArgumentException, IOException
{ {
logger.fine("sending STUN "
+ " tid " + transactionID
+ " from " + localAddress
+ " to " + requestDestination);
sendRequest0(); sendRequest0();
retransmissionsThread.start(); retransmissionsThread.start();
@ -330,7 +335,7 @@ class StunClientTransaction
} }
catch (InterruptedException ex) catch (InterruptedException ex)
{ {
logger.log(Level.FINE, "Interrupted", ex); throw new RuntimeException(ex);
} }
} }
@ -366,6 +371,7 @@ class StunClientTransaction
*/ */
synchronized void handleResponse(StunMessageEvent evt) synchronized void handleResponse(StunMessageEvent evt)
{ {
logger.log(Level.FINE, "handleResponse tid " + getTransactionID());
if( !Boolean.getBoolean(StackProperties.KEEP_CRANS_AFTER_A_RESPONSE) ) if( !Boolean.getBoolean(StackProperties.KEEP_CRANS_AFTER_A_RESPONSE) )
this.cancel(); this.cancel();