Adds parsing for incoming priority attributes. Makes the ICE Agent only start the checks with a single stream Completes support for storing application data in transaction IDs so that we could keep in there references to CandidatePair-s

This commit is contained in:
emcho 2010-05-01 21:36:07 +00:00
parent f0a6ba00c9
commit 8f528bbafc
7 changed files with 42 additions and 22 deletions

View File

@ -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

View File

@ -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

View File

@ -34,6 +34,9 @@ public class PriorityAttribute
*/
private long priority = 0;
/**
* Creates a priority attribute.
*/
public PriorityAttribute()
{
super(PRIORITY);

View File

@ -294,12 +294,8 @@ public class Agent
List<IceMediaStream> streams = getStreams();
for(IceMediaStream stream : streams)
{
CheckList list = stream.getCheckList();
connCheckClient.startChecks(list);
}
CheckList list = streams.get(0).getCheckList();
connCheckClient.startChecks(list);
iceStarted = true;
}

View File

@ -62,16 +62,16 @@ public class ConnectivityCheckClient
this.parentAgent = parentAgent;
}
public void startChecks(CheckList checkList)
/**
* Starts client connectivity checks using <tt>checkList</tt> 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;
}

View File

@ -218,4 +218,16 @@ public class TransactionID
{
this.applicationData = applicationData;
}
/**
* Returns whatever <tt>applicationData</tt> 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;
}
}

View File

@ -60,6 +60,8 @@ public class Ice
System.out.println("Total execution time: "
+ (endTime - startTime) + "ms");
Thread.sleep(2500);
}
/**