Fixes a suspicious #remove() of a CheckList from a List<IceMediaStream>.

This commit is contained in:
lubomir.marinov 2010-10-12 20:52:19 +00:00
parent 99e0572c06
commit 3e28058a07

View File

@ -243,19 +243,22 @@ class ConnectivityCheckClient
*/ */
private void updateCheckListAndTimerStates(CandidatePair checkedPair) private void updateCheckListAndTimerStates(CandidatePair checkedPair)
{ {
IceMediaStream stream = checkedPair.getParentComponent() IceMediaStream stream
.getParentStream(); = checkedPair.getParentComponent().getParentStream();
CheckList checkList = stream.getCheckList(); CheckList checkList = stream.getCheckList();
//If all of the pairs in the check list are now either in the Failed or //If all of the pairs in the check list are now either in the Failed or
//Succeeded state: //Succeeded state:
boolean allPairsDone = true; boolean allPairsDone = true;
synchronized(checkList) synchronized(checkList)
{ {
for(CandidatePair pair : checkList) for(CandidatePair pair : checkList)
{ {
if(pair.getState() != CandidatePairState.FAILED CandidatePairState pairState = pair.getState();
&& pair.getState() != CandidatePairState.SUCCEEDED)
if((pairState != CandidatePairState.FAILED)
&& (pairState != CandidatePairState.SUCCEEDED))
{ {
allPairsDone = false; allPairsDone = false;
} }
@ -267,10 +270,7 @@ class ConnectivityCheckClient
//If there is not a pair in the valid list for each component of the //If there is not a pair in the valid list for each component of the
//media stream, the state of the check list is set to Failed. //media stream, the state of the check list is set to Failed.
if ( !stream.validListContainsAllComponents()) if ( !stream.validListContainsAllComponents())
{
checkList.setState(CheckListState.FAILED); checkList.setState(CheckListState.FAILED);
}
//For each frozen check list, the agent groups together all of the //For each frozen check list, the agent groups together all of the
//pairs with the same foundation, and for each group, sets the //pairs with the same foundation, and for each group, sets the
@ -278,10 +278,12 @@ class ConnectivityCheckClient
//there is more than one such pair, the one with the highest //there is more than one such pair, the one with the highest
//priority is used. //priority is used.
List<IceMediaStream> allOtherStreams = parentAgent.getStreams(); List<IceMediaStream> allOtherStreams = parentAgent.getStreams();
allOtherStreams.remove(checkList);
allOtherStreams.remove(stream);
for (IceMediaStream anotherStream : allOtherStreams) for (IceMediaStream anotherStream : allOtherStreams)
{ {
CheckList anotherCheckList = anotherStream.getCheckList(); CheckList anotherCheckList = anotherStream.getCheckList();
if(anotherCheckList.isFrozen()) if(anotherCheckList.isFrozen())
{ {
anotherCheckList.computeInitialCheckListPairStates(); anotherCheckList.computeInitialCheckListPairStates();