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:
parent
f0a6ba00c9
commit
8f528bbafc
@ -51,4 +51,5 @@ java.util.logging.ConsoleHandler.formatter = org.ice4j.util.Ice4jLogFormatter
|
|||||||
|
|
||||||
# Things coming from ice4j
|
# Things coming from ice4j
|
||||||
org.ice4j.level = INFO
|
org.ice4j.level = INFO
|
||||||
|
org.ice4j.ice.checks.levell = FINEST
|
||||||
|
|
||||||
|
|||||||
@ -123,6 +123,8 @@ public class AttributeDecoder
|
|||||||
decodedAttribute = new DontFragmentAttribute(); break;
|
decodedAttribute = new DontFragmentAttribute(); break;
|
||||||
case Attribute.RESERVATION_TOKEN:
|
case Attribute.RESERVATION_TOKEN:
|
||||||
decodedAttribute = new ReservationTokenAttribute(); break;
|
decodedAttribute = new ReservationTokenAttribute(); break;
|
||||||
|
case Attribute.PRIORITY:
|
||||||
|
decodedAttribute = new PriorityAttribute(); break;
|
||||||
|
|
||||||
//According to rfc3489 we should silently ignore unknown attributes.
|
//According to rfc3489 we should silently ignore unknown attributes.
|
||||||
default: decodedAttribute
|
default: decodedAttribute
|
||||||
|
|||||||
@ -34,6 +34,9 @@ public class PriorityAttribute
|
|||||||
*/
|
*/
|
||||||
private long priority = 0;
|
private long priority = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a priority attribute.
|
||||||
|
*/
|
||||||
public PriorityAttribute()
|
public PriorityAttribute()
|
||||||
{
|
{
|
||||||
super(PRIORITY);
|
super(PRIORITY);
|
||||||
|
|||||||
@ -294,12 +294,8 @@ public class Agent
|
|||||||
|
|
||||||
List<IceMediaStream> streams = getStreams();
|
List<IceMediaStream> streams = getStreams();
|
||||||
|
|
||||||
for(IceMediaStream stream : streams)
|
CheckList list = streams.get(0).getCheckList();
|
||||||
{
|
connCheckClient.startChecks(list);
|
||||||
CheckList list = stream.getCheckList();
|
|
||||||
|
|
||||||
connCheckClient.startChecks(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
iceStarted = true;
|
iceStarted = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,16 +62,16 @@ public class ConnectivityCheckClient
|
|||||||
this.parentAgent = parentAgent;
|
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
|
PaceMaker paceMaker = new PaceMaker(this, firstCheckList);
|
||||||
//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);
|
|
||||||
paceMakers.add(paceMaker);
|
paceMakers.add(paceMaker);
|
||||||
|
|
||||||
paceMaker.start();
|
paceMaker.start();
|
||||||
@ -167,7 +167,8 @@ public class ConnectivityCheckClient
|
|||||||
|
|
||||||
public void processTimeout(StunTimeoutEvent event)
|
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.
|
//any active check lists at that point yet.
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
wait(parentClient.parentAgent.calculateTa()
|
wait(waitFor);
|
||||||
* parentClient.parentAgent
|
|
||||||
.getActiveCheckListCount());
|
|
||||||
}
|
}
|
||||||
catch (InterruptedException e)
|
catch (InterruptedException e)
|
||||||
{
|
{
|
||||||
@ -241,21 +240,26 @@ public class ConnectivityCheckClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkList.setState(CheckListState.RUNNING);
|
|
||||||
|
|
||||||
CandidatePair pairToCheck = checkList.popTriggeredCheck();
|
CandidatePair pairToCheck = checkList.popTriggeredCheck();
|
||||||
TransactionID transactionID = null;
|
TransactionID transactionID = null;
|
||||||
|
|
||||||
|
//if there are no triggered checks, go for an ordinary one.
|
||||||
|
if(pairToCheck == null)
|
||||||
|
pairToCheck = checkList.getNextOrdinaryPairToCheck();
|
||||||
|
|
||||||
if(pairToCheck != null)
|
if(pairToCheck != null)
|
||||||
transactionID = parentClient.startCheckForPair(pairToCheck);
|
transactionID = parentClient.startCheckForPair(pairToCheck);
|
||||||
|
|
||||||
pairToCheck = checkList.getNextOrdinaryPairToCheck();
|
|
||||||
|
|
||||||
if(pairToCheck == null)
|
if(pairToCheck == null)
|
||||||
{
|
{
|
||||||
//we are done sending checks for this list. we'll send its
|
//we are done sending checks for this list. we'll send its
|
||||||
//final state in either the processResponse()
|
//final state in either the processResponse()
|
||||||
//processTimeout() or processFailure() method.
|
//processTimeout() or processFailure() method.
|
||||||
|
|
||||||
|
logger.finest("finished a checklist");
|
||||||
|
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -218,4 +218,16 @@ public class TransactionID
|
|||||||
{
|
{
|
||||||
this.applicationData = applicationData;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,6 +60,8 @@ public class Ice
|
|||||||
|
|
||||||
System.out.println("Total execution time: "
|
System.out.println("Total execution time: "
|
||||||
+ (endTime - startTime) + "ms");
|
+ (endTime - startTime) + "ms");
|
||||||
|
|
||||||
|
Thread.sleep(2500);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user