Repairs condition for a check list to enter the COMPLETED state. Was: every component needs to have a nominated candidate, Is: Every component needs to have a nominated candidate whose nomination check has succeeded

This commit is contained in:
emcho 2010-05-18 07:25:59 +00:00
parent 69ed45c7d3
commit 5875d4dec1
9 changed files with 57 additions and 19 deletions

View File

@ -153,6 +153,18 @@
</java>
</target>
<!-- runs our sample distributed application -->
<target name="run-sample">
<java fork="true"
classname="test.Ice"
classpathref="project.class.path">
<!-- Tell java.util.logging about our logging preferences -->
<sysproperty key="java.util.logging.config.file"
value="lib/logging.properties"/>
</java>
</target>
<!-- runs our sample distributed application -->
<target name="run-dist">
<java fork="true"

View File

@ -51,5 +51,6 @@ java.util.logging.ConsoleHandler.formatter = org.ice4j.util.Ice4jLogFormatter
# Things coming from ice4j
org.ice4j.level = INFO
org.ice4j.ice.checks.levell = FINEST
#org.ice4j.ice.checks.levell = FINEST
#org.ice4j.ice.ConnectivityCheckClient.level = FINER

View File

@ -1126,12 +1126,18 @@ public class Agent
CheckList checkList = parentStream.getCheckList();
if( checkList.getState() == CheckListState.RUNNING )
checkList.handleNomination(nominatedPair);
{
System.out.println("nomination confirmed for " + checkList.getName());
checkList.handleNominationConfirmed(nominatedPair);
}
else
System.out.println("ignoring nomination confirmed for " + checkList.getName()
+ "because checklsitstate=" + checkList.getState() + " && pstreamcompleted=" + parentStream.allComponentsAreNominated());
//Once there is at least one nominated pair in the valid list for
//every component of the media stream and the state of the
//check list is Running
if(parentStream.allComponentsAreNominated()
if(parentStream.allComponentsHaveSelected()
&& checkList.getState() == CheckListState.RUNNING)
{
//The agent MUST change the state of processing for its check

View File

@ -350,7 +350,8 @@ public class CheckList
* @param nominatedPair the {@link CandidatePair} whose nomination we need
* to handle.
*/
protected synchronized void handleNomination(CandidatePair nominatedPair)
protected synchronized void handleNominationConfirmed(
CandidatePair nominatedPair)
{
Component cmp = nominatedPair.getParentComponent();

View File

@ -47,7 +47,7 @@ class ConnectivityCheckServer
*
* @param parentAgent the <tt>Agent</tt> that is creating this instance.
*/
public ConnectivityCheckServer(Agent parentAgent)
public ConnectivityCheckServer(Agent parentAgent)
{
this.parentAgent = parentAgent;
stunStack.addRequestListener(this);

View File

@ -637,9 +637,9 @@ public class IceMediaStream
}
/**
* Returns <tt>true</tt> if there is at least one nominated {@link
* Returns <tt>false</tt> if there is at least one nominated {@link
* CandidatePair} in the valid list for every {@link Component} of this
* stream and <tt>false</tt> otherwise.
* stream and <tt>true</tt> otherwise.
*
* @return <tt>true</tt> if there is at least one nominated {@link
* CandidatePair} in the valid list for every {@link Component} of this
@ -659,6 +659,26 @@ public class IceMediaStream
return components.size() == 0;
}
/**
* Returns <tt>false</tt> if there is at least one nominated {@link
* CandidatePair} who doesn't have a selected address yet, and <tt>true</tt>
* otherwise.
*
* @return <tt>false</tt> if there is at least one nominated {@link
* CandidatePair} who doesn't have a selected address yet, and <tt>true</tt>
* otherwise.
*/
protected boolean allComponentsHaveSelected()
{
List<Component> components = getComponents();
for(Component component : components)
if(component.getSelectedPair() == null)
return false;
return true;
}
/**
* Returns the first {@link CandidatePair} stored in this stream's valid
* list, that belongs to the specified <tt>component</tt>.

View File

@ -49,26 +49,26 @@ class StunClientTransaction
/**
* Maximum number of retransmissions. Once this number is reached and if no
* response is received after MAX_WAIT_INTERVAL miliseconds the request is
* response is received after MAX_WAIT_INTERVAL milliseconds the request is
* considered unanswered.
*/
public int maxRetransmissions = DEFAULT_MAX_RETRANSMISSIONS;
/**
* The number of miliseconds a client should wait before retransmitting,
* The number of milliseconds a client should wait before retransmitting,
* after it has sent a request for the first time.
*/
public static final int DEFAULT_ORIGINAL_WAIT_INTERVAL = 100;
/**
* The number of miliseconds to wait before the first retansmission of the
* The number of milliseconds to wait before the first retransmission of the
* request.
*/
public int originalWaitInterval = DEFAULT_ORIGINAL_WAIT_INTERVAL;
/**
* The maximum number of miliseconds a client should wait between
* consecutive retransmissionse, after it has sent a request for the first
* The maximum number of milliseconds a client should wait between
* consecutive retransmissions, after it has sent a request for the first
* time.
*/
public static final int DEFAULT_MAX_WAIT_INTERVAL = 1600;
@ -291,10 +291,9 @@ class StunClientTransaction
logger.finer("Trying to resend a cancelled transaction.");
return;
}
stackCallback.getNetAccessManager().sendMessage(
this.request,
localAddress,
requestDestination);
this.request, localAddress, requestDestination);
}
/**

View File

@ -287,8 +287,8 @@ public class Ice
+ (endTime - startTime) +" ms");
startTime = endTime;
//rtcpComp
//agent.createComponent(
// stream, Transport.UDP, rtpPort + 1, rtpPort + 1, rtpPort + 101);
agent.createComponent(
stream, Transport.UDP, rtpPort + 1, rtpPort + 1, rtpPort + 101);
endTime = System.currentTimeMillis();
System.out.println("RTCP Component created in "

View File

@ -34,8 +34,6 @@ public class IceDistributed
*/
public static void main(String[] args) throws Throwable
{
startTime = System.currentTimeMillis();
Agent localAgent = createAgent(2020);
localAgent.setNominationStrategy(
NominationStrategy.NOMINATE_HIGHEST_PRIO);
@ -56,6 +54,7 @@ public class IceDistributed
String sdp = readSDP();
startTime = System.currentTimeMillis();
SdpUtils.parseSDP(localAgent, sdp);
localAgent.startConnectivityEstablishment();