feat: Handles pairs discovered late,
after the Agent has completed/terminated.
This commit is contained in:
parent
cefd964509
commit
0f86b8797f
@ -1541,19 +1541,8 @@ public class Agent
|
|||||||
String localUFrag,
|
String localUFrag,
|
||||||
boolean useCandidate)
|
boolean useCandidate)
|
||||||
{
|
{
|
||||||
if (isOver())
|
|
||||||
{
|
|
||||||
//means we already completed ICE and are happily running media
|
|
||||||
//the only reason we are called is most probably because the remote
|
|
||||||
//party is still sending Binding Requests our way and making sure we
|
|
||||||
//are still alive.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String ufrag = null;
|
String ufrag = null;
|
||||||
LocalCandidate localCandidate = null;
|
LocalCandidate localCandidate = findLocalCandidate(localAddress);
|
||||||
|
|
||||||
localCandidate = findLocalCandidate(localAddress);
|
|
||||||
|
|
||||||
if (localCandidate == null)
|
if (localCandidate == null)
|
||||||
{
|
{
|
||||||
@ -1563,9 +1552,8 @@ public class Agent
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component parentComponent = localCandidate.getParentComponent();
|
Component parentComponent = localCandidate.getParentComponent();
|
||||||
RemoteCandidate remoteCandidate = null;
|
RemoteCandidate remoteCandidate
|
||||||
|
= new RemoteCandidate(
|
||||||
remoteCandidate = new RemoteCandidate(
|
|
||||||
remoteAddress,
|
remoteAddress,
|
||||||
parentComponent,
|
parentComponent,
|
||||||
CandidateType.PEER_REFLEXIVE_CANDIDATE,
|
CandidateType.PEER_REFLEXIVE_CANDIDATE,
|
||||||
@ -1588,25 +1576,30 @@ public class Agent
|
|||||||
|
|
||||||
synchronized(startLock)
|
synchronized(startLock)
|
||||||
{
|
{
|
||||||
if (isStarted())
|
if (state == IceProcessingState.WAITING)
|
||||||
{
|
|
||||||
//we are started, which means we have the remote candidates
|
|
||||||
//so it's now safe to go and see whether this is a new PR cand.
|
|
||||||
if (triggeredPair.getParentComponent().getSelectedPair() == null)
|
|
||||||
{
|
|
||||||
logger.info("Received check from "
|
|
||||||
+ triggeredPair.toShortString() + " triggered a check. "
|
|
||||||
+ "Local ufrag " + getLocalUfrag());
|
|
||||||
}
|
|
||||||
triggerCheck(triggeredPair);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
logger.fine("Receive STUN checks before our ICE has started");
|
logger.fine("Receive STUN checks before our ICE has started");
|
||||||
//we are not started yet so we'd better wait until we get the
|
//we are not started yet so we'd better wait until we get the
|
||||||
//remote candidates in case we are holding to a new PR one.
|
//remote candidates in case we are holding to a new PR one.
|
||||||
this.preDiscoveredPairsQueue.add(triggeredPair);
|
this.preDiscoveredPairsQueue.add(triggeredPair);
|
||||||
}
|
}
|
||||||
|
else if (state == IceProcessingState.FAILED)
|
||||||
|
{
|
||||||
|
// Failure is permanent, currently.
|
||||||
|
}
|
||||||
|
else //Running, Connected or Terminated.
|
||||||
|
{
|
||||||
|
if (logger.isLoggable(Level.FINE))
|
||||||
|
{
|
||||||
|
logger.debug("Received check from "
|
||||||
|
+ triggeredPair.toShortString() + " triggered a check. "
|
||||||
|
+ "Local ufrag " + getLocalUfrag());
|
||||||
|
}
|
||||||
|
|
||||||
|
// We have been started, and have not failed (yet). If this is
|
||||||
|
// a new pair, handle it (even if we have already completed).
|
||||||
|
triggerCheck(triggeredPair);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user