From ab877ab6f7690c3b4e821c9dda476299421a0e78 Mon Sep 17 00:00:00 2001 From: emcho Date: Sat, 8 May 2010 21:38:10 +0000 Subject: [PATCH] Commits work on pair nomination (Section 8.1.1). Work in progress --- src/org/ice4j/ice/Agent.java | 12 ++++----- src/org/ice4j/ice/CheckList.java | 43 +++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 19 deletions(-) diff --git a/src/org/ice4j/ice/Agent.java b/src/org/ice4j/ice/Agent.java index 409dbc3..88fb465 100644 --- a/src/org/ice4j/ice/Agent.java +++ b/src/org/ice4j/ice/Agent.java @@ -937,14 +937,12 @@ public class Agent //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. - 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 - retransmissions for its check if its pair priority is lower - than the lowest-priority nominated pair for that component.*/ + //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.*/ } /* diff --git a/src/org/ice4j/ice/CheckList.java b/src/org/ice4j/ice/CheckList.java index 25b23b3..cb03c2b 100644 --- a/src/org/ice4j/ice/CheckList.java +++ b/src/org/ice4j/ice/CheckList.java @@ -278,21 +278,37 @@ public class CheckList /** * Removes from this CheckList and its associated triggered check * queue all {@link CandidatePair}s that are in the Waiting and - * Frozen states and that belong to the specified - * component. Typically this will happen upon confirmation of the - * nomination of one pair in that component. + * Frozen states and that belong to the same {@link Component} as + * nominatedPair. Typically this will happen upon confirmation of + * 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: + *

+ * 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. + *

+ * 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. + *

* - * @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 pairsIter = iterator(); while(pairsIter.hasNext()) { CandidatePair pair = pairsIter.next(); if (pair.getParentComponent() == cmp - && pair.getState() == CandidatePairState.WAITING - && pair.getState() == CandidatePairState.FROZEN) + &&( pair.getState() == CandidatePairState.WAITING + || pair.getState() == CandidatePairState.FROZEN + || (pair.getState() == CandidatePairState.IN_PROGRESS + && pair.getPriority() < nominatedPair.getPriority()))) { pairsIter.remove(); } @@ -306,13 +322,16 @@ public class CheckList { CandidatePair pair = triggeredPairsIter.next(); if (pair.getParentComponent() == cmp - && pair.getState() == CandidatePairState.WAITING - && pair.getState() == CandidatePairState.FROZEN) - { - triggeredPairsIter.remove(); + &&( pair.getState() == CandidatePairState.WAITING + || pair.getState() == CandidatePairState.FROZEN + || (pair.getState() == CandidatePairState.IN_PROGRESS + && pair.getPriority() < nominatedPair + .getPriority()))) + { + triggeredPairsIter.remove(); + } } } - } } }