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

View File

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

View File

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