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
// the pair is then changed to Waiting.
// 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,9 +207,13 @@ public class CheckList
{
for (CandidatePair pair : this)
{
if (pair.getState() != CandidatePairState.SUCCEEDED
&& pair.getState() != CandidatePairState.FAILED)
CandidatePairState pairState = pair.getState();
if ((pairState != CandidatePairState.SUCCEEDED)
&& (pairState != CandidatePairState.FAILED))
{
return false;
}
}
return true;
}
@ -229,7 +233,6 @@ public class CheckList
if (pair.getState() != CandidatePairState.FROZEN)
return false;
}
return true;
}

View File

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

View File

@ -102,7 +102,7 @@ class ConnectivityCheckServer
&& request.containsAttribute(Attribute.ICE_CONTROLLED)))
{
if (!repairRoleConflict(evt))
return;
return;
}
long priority = extractPriority(request);

View File

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