Starts the connectivity checks for a CheckList when a triggered check is scheduled. Otherwise, the Agent may run forever.

This commit is contained in:
lubomir.marinov 2010-10-14 19:37:18 +00:00
parent 7ff7ed83e9
commit 1d3ce5ee57
5 changed files with 26 additions and 9 deletions

View File

@ -1079,7 +1079,21 @@ public class Agent
// enqueueing the pair in the triggered check queue. The state of // enqueueing the pair in the triggered check queue. The state of
// the pair is then changed to Waiting. // the pair is then changed to Waiting.
// Emil: This actually applies for all cases. // Emil: This actually applies for all cases.
parentStream.getCheckList().scheduleTriggeredCheck(triggerPair); /*
* Lyubomir: The connectivity checks for a CheckList are started
* elsewhere as soon as and only if the CheckList changes from fronzen
* to unfrozen. Since CheckList#scheduleTriggeredCheck will change
* triggerPair to Waiting and will thus unfreeze its CheckList, make
* sure that the connectivity checks for the CheckList are started.
* Otherwise, the connectivity checks for the CheckList may never be
* started (which may make the Agent remain running forever).
*/
CheckList checkList = parentStream.getCheckList();
boolean wasFrozen = checkList.isFrozen();
checkList.scheduleTriggeredCheck(triggerPair);
if (wasFrozen && !checkList.isFrozen())
connCheckClient.startChecks(checkList);
} }
/** /**

View File

@ -207,10 +207,14 @@ public class CheckList
{ {
for (CandidatePair pair : this) for (CandidatePair pair : this)
{ {
if (pair.getState() != CandidatePairState.SUCCEEDED CandidatePairState pairState = pair.getState();
&& pair.getState() != CandidatePairState.FAILED)
if ((pairState != CandidatePairState.SUCCEEDED)
&& (pairState != CandidatePairState.FAILED))
{
return false; return false;
} }
}
return true; return true;
} }
@ -229,7 +233,6 @@ public class CheckList
if (pair.getState() != CandidatePairState.FROZEN) if (pair.getState() != CandidatePairState.FROZEN)
return false; return false;
} }
return true; return true;
} }

View File

@ -69,8 +69,8 @@ class ConnectivityCheckClient
*/ */
public void startChecks() public void startChecks()
{ {
CheckList firstCheckList = parentAgent.getStreams().get(0) CheckList firstCheckList
.getCheckList(); = parentAgent.getStreams().get(0).getCheckList();
startChecks(firstCheckList); startChecks(firstCheckList);
} }
@ -82,7 +82,7 @@ class ConnectivityCheckClient
* @param checkList the {@link CheckList} to start client side connectivity * @param checkList the {@link CheckList} to start client side connectivity
* checks for. * checks for.
*/ */
private void startChecks(CheckList checkList) public void startChecks(CheckList checkList)
{ {
PaceMaker paceMaker = new PaceMaker(checkList); PaceMaker paceMaker = new PaceMaker(checkList);
@ -261,6 +261,7 @@ class ConnectivityCheckClient
&& (pairState != CandidatePairState.SUCCEEDED)) && (pairState != CandidatePairState.SUCCEEDED))
{ {
allPairsDone = false; allPairsDone = false;
break;
} }
} }
} }

View File

@ -603,7 +603,6 @@ public class IceMediaStream
if (pair.getFoundation().equals(foundation)) if (pair.getFoundation().equals(foundation))
return true; return true;
} }
return false; return false;
} }