Fixes a problem with symmetrical NAT (detected with a test on 3G network).

This commit is contained in:
seb 2011-10-17 14:35:20 +00:00
parent 1d8fd98bd5
commit bee319845b
3 changed files with 25 additions and 32 deletions

View File

@ -1261,7 +1261,17 @@ public class Agent
return;
}
useCandidate = pair.useCandidateReceived();
CandidatePair pair2 = findCandidatePair(
localCandidate.getTransportAddress(),
remoteAddress);
if(pair2 == null)
{
useCandidate = false;
}
else
{
useCandidate = pair2.useCandidateReceived();
}
remoteCandidate = new RemoteCandidate(
remoteAddress, parentComponent,
@ -1326,26 +1336,9 @@ public class Agent
//we've just discovered a peer-reflexive candidate.
CandidatePair knownPair = null;
if(compatibilityMode == CompatibilityMode.RFC5245)
knownPair = this.findCandidatePair(
triggerPair.getLocalCandidate().getTransportAddress(),
triggerPair.getRemoteCandidate().getTransportAddress());
else
{
if(triggerPair.getLocalCandidate().getTransport() == Transport.TCP)
{
knownPair = findCandidatePair(
triggerPair.getLocalCandidate().getTransportAddress(),
triggerPair.getRemoteCandidate().getTransportAddress());
}
else
{
knownPair = findCandidatePair(
((RemoteCandidate)triggerPair.getRemoteCandidate()).
getUfrag(),
triggerPair.getLocalCandidate().getUfrag());
}
}
knownPair = this.findCandidatePair(
triggerPair.getLocalCandidate().getTransportAddress(),
triggerPair.getRemoteCandidate().getTransportAddress());
IceMediaStream parentStream = triggerPair.getLocalCandidate()
.getParentComponent().getParentStream();
@ -1423,6 +1416,7 @@ public class Agent
//
logger.info("Add peer CandidatePair with new reflexive address to" +
" checkList");
triggerPair.setUseCandidateReceived();
parentStream.addToCheckList(triggerPair);
}

View File

@ -340,14 +340,14 @@ public class Component
upnpBase = lc.getBase();
}
}
if(upnpBase != null)
{
localCnds.remove(upnpBase);
}
checkList = new Vector<CandidatePair>();
for(LocalCandidate localCnd : localCnds)
{
if(localCnd == upnpBase)
continue;
if(parentStream.getParentAgent().
getCompatibilityMode() == CompatibilityMode.GTALK &&
localCnd.getIceSocketWrapper() instanceof

View File

@ -352,9 +352,8 @@ public class IceMediaStream
{
List<LocalCandidate> localCnds = component.getLocalCandidates();
List<Candidate> remoteCnds = component.getRemoteCandidates();
// remove UPnP base from local candidate
LocalCandidate upnpBase = null;
for(LocalCandidate lc : localCnds)
{
if(lc instanceof UPNPCandidate)
@ -362,13 +361,13 @@ public class IceMediaStream
upnpBase = lc.getBase();
}
}
if(upnpBase != null)
{
localCnds.remove(upnpBase);
}
for(LocalCandidate localCnd : localCnds)
{
// Don't take into consideration UPnP base candidate
if(localCnd == upnpBase)
continue;
for(Candidate remoteCnd : remoteCnds)
{
if(localCnd.canReach(remoteCnd))
@ -419,7 +418,7 @@ public class IceMediaStream
}
}
}.start();
return;
continue;
}
CandidatePair pair = new CandidatePair(localCnd,