diff --git a/lib/logging.properties b/lib/logging.properties index 4a63bc5..53b072e 100644 --- a/lib/logging.properties +++ b/lib/logging.properties @@ -51,4 +51,5 @@ java.util.logging.ConsoleHandler.formatter = org.ice4j.util.Ice4jLogFormatter # Things coming from ice4j org.ice4j.level = INFO +org.ice4j.ice.checks.levell = FINEST diff --git a/src/org/ice4j/attribute/AttributeDecoder.java b/src/org/ice4j/attribute/AttributeDecoder.java index 7795e40..7a3abd9 100644 --- a/src/org/ice4j/attribute/AttributeDecoder.java +++ b/src/org/ice4j/attribute/AttributeDecoder.java @@ -123,6 +123,8 @@ public class AttributeDecoder decodedAttribute = new DontFragmentAttribute(); break; case Attribute.RESERVATION_TOKEN: decodedAttribute = new ReservationTokenAttribute(); break; + case Attribute.PRIORITY: + decodedAttribute = new PriorityAttribute(); break; //According to rfc3489 we should silently ignore unknown attributes. default: decodedAttribute diff --git a/src/org/ice4j/attribute/PriorityAttribute.java b/src/org/ice4j/attribute/PriorityAttribute.java index e22875d..9af8a48 100644 --- a/src/org/ice4j/attribute/PriorityAttribute.java +++ b/src/org/ice4j/attribute/PriorityAttribute.java @@ -34,6 +34,9 @@ public class PriorityAttribute */ private long priority = 0; + /** + * Creates a priority attribute. + */ public PriorityAttribute() { super(PRIORITY); diff --git a/src/org/ice4j/ice/Agent.java b/src/org/ice4j/ice/Agent.java index ffba09a..6afe4af 100644 --- a/src/org/ice4j/ice/Agent.java +++ b/src/org/ice4j/ice/Agent.java @@ -294,12 +294,8 @@ public class Agent List streams = getStreams(); - for(IceMediaStream stream : streams) - { - CheckList list = stream.getCheckList(); - - connCheckClient.startChecks(list); - } + CheckList list = streams.get(0).getCheckList(); + connCheckClient.startChecks(list); iceStarted = true; } diff --git a/src/org/ice4j/ice/checks/ConnectivityCheckClient.java b/src/org/ice4j/ice/checks/ConnectivityCheckClient.java index 9319219..e3771b8 100644 --- a/src/org/ice4j/ice/checks/ConnectivityCheckClient.java +++ b/src/org/ice4j/ice/checks/ConnectivityCheckClient.java @@ -62,16 +62,16 @@ public class ConnectivityCheckClient this.parentAgent = parentAgent; } - public void startChecks(CheckList checkList) + /** + * Starts client connectivity checks using checkList as the + * {@link CheckList} of the first {@link IceMediaStream}. + * + * @param firstCheckList the check list that we should start our checks + * with. + */ + public void startChecks(CheckList firstCheckList) { - //RFC 5245 says: Implementations SHOULD take care to spread out these - //timers so that they do not fire at the same time for each media - //stream. - //Emil: so let's make sure we spread the pace makers - - System.currentTimeMillis(); - - PaceMaker paceMaker = new PaceMaker(this, checkList); + PaceMaker paceMaker = new PaceMaker(this, firstCheckList); paceMakers.add(paceMaker); paceMaker.start(); @@ -167,7 +167,8 @@ public class ConnectivityCheckClient public void processTimeout(StunTimeoutEvent event) { - System.out.println("timeout event=" + event); + System.out.println("timeout for pair=" + event.getTransactionID().getApplicationData()); + } /** @@ -228,9 +229,7 @@ public class ConnectivityCheckClient //any active check lists at that point yet. try { - wait(parentClient.parentAgent.calculateTa() - * parentClient.parentAgent - .getActiveCheckListCount()); + wait(waitFor); } catch (InterruptedException e) { @@ -241,21 +240,26 @@ public class ConnectivityCheckClient return; } - checkList.setState(CheckListState.RUNNING); - CandidatePair pairToCheck = checkList.popTriggeredCheck(); TransactionID transactionID = null; + //if there are no triggered checks, go for an ordinary one. + if(pairToCheck == null) + pairToCheck = checkList.getNextOrdinaryPairToCheck(); + if(pairToCheck != null) transactionID = parentClient.startCheckForPair(pairToCheck); - pairToCheck = checkList.getNextOrdinaryPairToCheck(); + if(pairToCheck == null) { //we are done sending checks for this list. we'll send its //final state in either the processResponse() //processTimeout() or processFailure() method. + + logger.finest("finished a checklist"); + isRunning = false; return; } diff --git a/src/org/ice4j/stack/TransactionID.java b/src/org/ice4j/stack/TransactionID.java index 39e3a43..8081ed5 100644 --- a/src/org/ice4j/stack/TransactionID.java +++ b/src/org/ice4j/stack/TransactionID.java @@ -218,4 +218,16 @@ public class TransactionID { this.applicationData = applicationData; } + + /** + * Returns whatever applicationData was previously stored in this + * ID. + * + * @return a reference to the {@link Object} that the application may have + * stored in this ID's application data field. + */ + public Object getApplicationData() + { + return applicationData; + } } diff --git a/test/test/Ice.java b/test/test/Ice.java index a6b7caf..8fc8934 100644 --- a/test/test/Ice.java +++ b/test/test/Ice.java @@ -60,6 +60,8 @@ public class Ice System.out.println("Total execution time: " + (endTime - startTime) + "ms"); + + Thread.sleep(2500); } /**