Search the candidate pair with local and remote frag rather than local and remote address for Google ICE. Handles the TCP connect in separate threads in order to not block the start of ICE.
This commit is contained in:
parent
169e56c22f
commit
3cc3c94b63
@ -1244,7 +1244,6 @@ public class Agent
|
|||||||
}
|
}
|
||||||
|
|
||||||
Component parentComponent = localCandidate.getParentComponent();
|
Component parentComponent = localCandidate.getParentComponent();
|
||||||
|
|
||||||
RemoteCandidate remoteCandidate = null;
|
RemoteCandidate remoteCandidate = null;
|
||||||
|
|
||||||
// we need to find the username for the couple
|
// we need to find the username for the couple
|
||||||
@ -1281,7 +1280,6 @@ public class Agent
|
|||||||
CandidatePair triggeredPair
|
CandidatePair triggeredPair
|
||||||
= new CandidatePair(localCandidate, remoteCandidate);
|
= new CandidatePair(localCandidate, remoteCandidate);
|
||||||
|
|
||||||
|
|
||||||
logger.info("set use-candidate " + useCandidate + " for pair " +
|
logger.info("set use-candidate " + useCandidate + " for pair " +
|
||||||
triggeredPair.toShortString());
|
triggeredPair.toShortString());
|
||||||
if(useCandidate)
|
if(useCandidate)
|
||||||
@ -1322,9 +1320,17 @@ public class Agent
|
|||||||
{
|
{
|
||||||
//first check whether we already know about the remote address in case
|
//first check whether we already know about the remote address in case
|
||||||
//we've just discovered a peer-reflexive candidate.
|
//we've just discovered a peer-reflexive candidate.
|
||||||
CandidatePair knownPair = this.findCandidatePair(
|
CandidatePair knownPair = null;
|
||||||
|
|
||||||
|
if(compatibilityMode == CompatibilityMode.RFC5245)
|
||||||
|
knownPair = this.findCandidatePair(
|
||||||
triggerPair.getLocalCandidate().getTransportAddress(),
|
triggerPair.getLocalCandidate().getTransportAddress(),
|
||||||
triggerPair.getRemoteCandidate().getTransportAddress());
|
triggerPair.getRemoteCandidate().getTransportAddress());
|
||||||
|
else
|
||||||
|
knownPair = findCandidatePair(
|
||||||
|
((RemoteCandidate)triggerPair.getRemoteCandidate()).
|
||||||
|
getUfrag(),
|
||||||
|
triggerPair.getLocalCandidate().getUfrag());
|
||||||
|
|
||||||
IceMediaStream parentStream = triggerPair.getLocalCandidate()
|
IceMediaStream parentStream = triggerPair.getLocalCandidate()
|
||||||
.getParentComponent().getParentStream();
|
.getParentComponent().getParentStream();
|
||||||
@ -1364,7 +1370,8 @@ public class Agent
|
|||||||
//ICE processing state.
|
//ICE processing state.
|
||||||
checkListStatesUpdated();
|
checkListStatesUpdated();
|
||||||
}
|
}
|
||||||
else if(!isControlling())
|
else if(compatibilityMode != CompatibilityMode.RFC5245 &&
|
||||||
|
!isControlling())
|
||||||
{
|
{
|
||||||
//next time we will see a request it will be considered as
|
//next time we will see a request it will be considered as
|
||||||
// having USE-CANDIDATE
|
// having USE-CANDIDATE
|
||||||
|
|||||||
@ -308,7 +308,8 @@ class ConnectivityCheckClient
|
|||||||
= (CandidatePair) evt.getTransactionID().getApplicationData();
|
= (CandidatePair) evt.getTransactionID().getApplicationData();
|
||||||
|
|
||||||
//make sure that the response came from the right place.
|
//make sure that the response came from the right place.
|
||||||
if (!checkSymmetricAddresses(evt))
|
if (parentAgent.getCompatibilityMode() == CompatibilityMode.RFC5245 &&
|
||||||
|
!checkSymmetricAddresses(evt))
|
||||||
{
|
{
|
||||||
logger.fine("Received a non-symmetric response for pair: "
|
logger.fine("Received a non-symmetric response for pair: "
|
||||||
+ checkedPair.toShortString() + ". Failing");
|
+ checkedPair.toShortString() + ". Failing");
|
||||||
@ -673,7 +674,8 @@ class ConnectivityCheckClient
|
|||||||
if((parentAgent.isControlling()
|
if((parentAgent.isControlling()
|
||||||
&& request.containsAttribute(Attribute.USE_CANDIDATE)) ||
|
&& request.containsAttribute(Attribute.USE_CANDIDATE)) ||
|
||||||
((parentAgent.getCompatibilityMode() ==
|
((parentAgent.getCompatibilityMode() ==
|
||||||
CompatibilityMode.GTALK) && //validPair.isNominated()))
|
CompatibilityMode.GTALK) &&
|
||||||
|
//validPair.isNominated()))
|
||||||
checkedPair.useCandidateSent()))
|
checkedPair.useCandidateSent()))
|
||||||
{
|
{
|
||||||
if(validPair.getParentComponent().getSelectedPair() == null)
|
if(validPair.getParentComponent().getSelectedPair() == null)
|
||||||
@ -693,7 +695,8 @@ class ConnectivityCheckClient
|
|||||||
//itself had the USE-CANDIDATE attribute. This case is described in
|
//itself had the USE-CANDIDATE attribute. This case is described in
|
||||||
//Section 7.2.1.5, and may now result in setting the nominated flag for
|
//Section 7.2.1.5, and may now result in setting the nominated flag for
|
||||||
//the pair learned from the original request.
|
//the pair learned from the original request.
|
||||||
else if(!parentAgent.isControlling() &&
|
else if(parentAgent.getCompatibilityMode() ==
|
||||||
|
CompatibilityMode.RFC5245 && !parentAgent.isControlling() &&
|
||||||
checkedPair.useCandidateReceived() &&
|
checkedPair.useCandidateReceived() &&
|
||||||
!checkedPair.isNominated())
|
!checkedPair.isNominated())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -347,8 +347,8 @@ public class IceMediaStream
|
|||||||
* pair and extract.
|
* pair and extract.
|
||||||
* @param checkList the list that we need to update with the new pairs.
|
* @param checkList the list that we need to update with the new pairs.
|
||||||
*/
|
*/
|
||||||
private void createCheckList(Component component,
|
private void createCheckList(final Component component,
|
||||||
List<CandidatePair> checkList)
|
final List<CandidatePair> checkList)
|
||||||
{
|
{
|
||||||
List<LocalCandidate> localCnds = component.getLocalCandidates();
|
List<LocalCandidate> localCnds = component.getLocalCandidates();
|
||||||
List<Candidate> remoteCnds = component.getRemoteCandidates();
|
List<Candidate> remoteCnds = component.getRemoteCandidates();
|
||||||
@ -377,8 +377,15 @@ public class IceMediaStream
|
|||||||
parentAgent.getCompatibilityMode() ==
|
parentAgent.getCompatibilityMode() ==
|
||||||
CompatibilityMode.GTALK)
|
CompatibilityMode.GTALK)
|
||||||
{
|
{
|
||||||
/* for TCP, create a new Candidate (a new connection)
|
final LocalCandidate loc = localCnd;
|
||||||
* to each of remote TCP candidates
|
final Candidate remot = remoteCnd;
|
||||||
|
|
||||||
|
new Thread()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
/* for TCP, create a new Candidate (a new
|
||||||
|
* connection) to each of remote TCP candidates
|
||||||
*/
|
*/
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -387,26 +394,36 @@ public class IceMediaStream
|
|||||||
sock.setSoTimeout(1000);
|
sock.setSoTimeout(1000);
|
||||||
|
|
||||||
sock.connect(new InetSocketAddress(
|
sock.connect(new InetSocketAddress(
|
||||||
remoteCnd.getTransportAddress().getAddress(),
|
remot.getTransportAddress().
|
||||||
remoteCnd.getTransportAddress().getPort()),
|
getAddress(),
|
||||||
|
remot.getTransportAddress().
|
||||||
|
getPort()),
|
||||||
1000);
|
1000);
|
||||||
|
|
||||||
sock.setSoTimeout(timeout);
|
sock.setSoTimeout(timeout);
|
||||||
LocalCandidate tmp =
|
LocalCandidate tmp =
|
||||||
new HostCandidate(new IceTcpSocketWrapper(sock),
|
new HostCandidate(
|
||||||
|
new IceTcpSocketWrapper(sock),
|
||||||
component);
|
component);
|
||||||
tmp.setUfrag(localCnd.getUfrag());
|
tmp.setUfrag(loc.getUfrag());
|
||||||
localCnd = tmp;
|
|
||||||
|
CandidatePair pair = new CandidatePair(tmp,
|
||||||
|
remot);
|
||||||
|
checkList.add(pair);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
logger.info("Failed to TCP connect to " +
|
logger.info("Failed to TCP connect to " +
|
||||||
remoteCnd.getTransportAddress());
|
remot.getTransportAddress());
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CandidatePair pair = new CandidatePair(localCnd, remoteCnd);
|
}.start();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CandidatePair pair = new CandidatePair(localCnd,
|
||||||
|
remoteCnd);
|
||||||
checkList.add(pair);
|
checkList.add(pair);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user