Commits work on pair nomination (Section 8.1.1). Work in progress

This commit is contained in:
emcho 2010-05-08 21:38:10 +00:00
parent 007d551863
commit ab877ab6f7
2 changed files with 36 additions and 19 deletions

View File

@ -937,14 +937,12 @@ public class Agent
//The agent MUST remove all Waiting and Frozen pairs in the check //The agent MUST remove all Waiting and Frozen pairs in the check
//list and triggered check queue for the same component as the //list and triggered check queue for the same component as the
//nominated pairs for that media stream. //nominated pairs for that media stream.
checkList.removeNonStartedPairsForComponent(parentComponent); checkList.removeNonCompledPairsForComponent(parentComponent);
/* /*
* //If an In-Progress pair in the check list is for the same
//component as a nominated pair, the agent SHOULD cease
* If an In-Progress pair in the check list is for the same //retransmissions for its check if its pair priority is lower
component as a nominated pair, the agent SHOULD cease //than the lowest-priority nominated pair for that component.*/
retransmissions for its check if its pair priority is lower
than the lowest-priority nominated pair for that component.*/
} }
/* /*

View File

@ -278,21 +278,37 @@ public class CheckList
/** /**
* Removes from this <tt>CheckList</tt> and its associated triggered check * Removes from this <tt>CheckList</tt> and its associated triggered check
* queue all {@link CandidatePair}s that are in the <tt>Waiting</tt> and * queue all {@link CandidatePair}s that are in the <tt>Waiting</tt> and
* <tt>Frozen</tt> states and that belong to the specified * <tt>Frozen</tt> states and that belong to the same {@link Component} as
* <tt>component</tt>. Typically this will happen upon confirmation of the * <tt>nominatedPair</tt>. Typically this will happen upon confirmation of
* nomination of one pair in that component. * the nomination of one pair in that component. The procedure implemented
* here represents one of the cases specified in RFC 5245, Section 8.1.2:
* <p>
* The agent MUST remove all Waiting and Frozen pairs in the check
* list and triggered check queue for the same component as the
* nominated pairs for that media stream.
* </p><p>
* If an In-Progress pair in the check list is for the same component as a
* nominated pair, the agent SHOULD cease retransmissions for its check
* if its pair priority is lower than the lowest-priority nominated pair
* for that component.
* </p>
* *
* @param cmp the {@link Component} whose pairs we want removed. * @param nominatedPair the {@link CandidatePair} whose nomination we need
* to handle.
*/ */
public synchronized void removeNonStartedPairsForComponent(Component cmp) public synchronized void removeNonCompledPairsForComponent(
CandidatePair nominatedPair)
{ {
Component cmp = nominatedPair.getParentComponent();
Iterator<CandidatePair> pairsIter = iterator(); Iterator<CandidatePair> pairsIter = iterator();
while(pairsIter.hasNext()) while(pairsIter.hasNext())
{ {
CandidatePair pair = pairsIter.next(); CandidatePair pair = pairsIter.next();
if (pair.getParentComponent() == cmp if (pair.getParentComponent() == cmp
&& pair.getState() == CandidatePairState.WAITING &&( pair.getState() == CandidatePairState.WAITING
&& pair.getState() == CandidatePairState.FROZEN) || pair.getState() == CandidatePairState.FROZEN
|| (pair.getState() == CandidatePairState.IN_PROGRESS
&& pair.getPriority() < nominatedPair.getPriority())))
{ {
pairsIter.remove(); pairsIter.remove();
} }
@ -306,13 +322,16 @@ public class CheckList
{ {
CandidatePair pair = triggeredPairsIter.next(); CandidatePair pair = triggeredPairsIter.next();
if (pair.getParentComponent() == cmp if (pair.getParentComponent() == cmp
&& pair.getState() == CandidatePairState.WAITING &&( pair.getState() == CandidatePairState.WAITING
&& pair.getState() == CandidatePairState.FROZEN) || pair.getState() == CandidatePairState.FROZEN
{ || (pair.getState() == CandidatePairState.IN_PROGRESS
triggeredPairsIter.remove(); && pair.getPriority() < nominatedPair
.getPriority())))
{
triggeredPairsIter.remove();
}
} }
} }
}
} }
} }