Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mondain committed Mar 30, 2021
1 parent 7d73473 commit 056060e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/main/java/org/ice4j/ice/ConnectivityCheckClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -606,17 +606,15 @@ public void run() {
pairToCheck.setStateFailed();
continue;
}
// Since we suspect that it is possible to startCheckForPair, processSuccessResponse and only then
// setStateInProgress, we'll synchronize. The synchronization root is the one of the CandidatePair#setState method.
//synchronized (pairToCheck) {
TransactionID transactionID = startCheckForPair(pairToCheck);
if (transactionID == null) {
logger.warn("Pair failed: {}", pairToCheck.toShortString());
pairToCheck.setStateFailed();
} else {
pairToCheck.setStateInProgress(transactionID);
}
//}
// Since we suspect that it is possible to startCheckForPair, processSuccessResponse and only then setStateInProgress, no synchronized
// since the CandidatePair#setState method is atomically enabled.
TransactionID transactionID = startCheckForPair(pairToCheck);
if (transactionID == null) {
logger.warn("Pair failed: {}", pairToCheck.toShortString());
pairToCheck.setStateFailed();
} else {
pairToCheck.setStateInProgress(transactionID);
}
} else {
// done sending checks for this list; set the final state in processResponse, processTimeout or processFailure method.
checkList.fireEndOfOrdinaryChecks();
Expand Down

0 comments on commit 056060e

Please sign in to comment.