Add also the HostCandidate used for UPnP gathering as it is needed for peer reflexive detection.
This commit is contained in:
parent
7dccafc489
commit
9353abd320
@ -964,7 +964,6 @@ public class Agent
|
|||||||
public CandidatePair findCandidatePair(TransportAddress localAddress,
|
public CandidatePair findCandidatePair(TransportAddress localAddress,
|
||||||
TransportAddress remoteAddress)
|
TransportAddress remoteAddress)
|
||||||
{
|
{
|
||||||
|
|
||||||
synchronized(mediaStreams)
|
synchronized(mediaStreams)
|
||||||
{
|
{
|
||||||
Collection<IceMediaStream> streamsCollection
|
Collection<IceMediaStream> streamsCollection
|
||||||
|
|||||||
@ -760,7 +760,6 @@ public class Component
|
|||||||
*/
|
*/
|
||||||
public LocalCandidate findLocalCandidate(TransportAddress localAddress)
|
public LocalCandidate findLocalCandidate(TransportAddress localAddress)
|
||||||
{
|
{
|
||||||
|
|
||||||
for( LocalCandidate localCnd : localCandidates)
|
for( LocalCandidate localCnd : localCandidates)
|
||||||
{
|
{
|
||||||
if(localCnd.getTransportAddress().equals(localAddress))
|
if(localCnd.getTransportAddress().equals(localAddress))
|
||||||
|
|||||||
@ -103,11 +103,20 @@ public class UPNPHarvester
|
|||||||
"UDP",
|
"UDP",
|
||||||
"Ice4J: " + port))
|
"Ice4J: " + port))
|
||||||
{
|
{
|
||||||
LocalCandidate cand = createUPNPCandidate(socket,
|
List<LocalCandidate> cands = createUPNPCandidate(socket,
|
||||||
localAddress, externalIPAddress, externalPort,
|
localAddress, externalIPAddress, externalPort,
|
||||||
component, device);
|
component, device);
|
||||||
|
|
||||||
|
// we have to add the UPNPCandidate and also the base.
|
||||||
|
// if we don't add the base, we won't be able to add
|
||||||
|
// peer reflexive candidate if someone contact us on the
|
||||||
|
// UPNPCandidate
|
||||||
|
for(LocalCandidate cand : cands)
|
||||||
|
{
|
||||||
component.addLocalCandidate(cand);
|
component.addLocalCandidate(cand);
|
||||||
candidates.add(cand);
|
candidates.add(cand);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -143,11 +152,12 @@ public class UPNPHarvester
|
|||||||
* represents the specified <tt>TransportAddress</tt>
|
* represents the specified <tt>TransportAddress</tt>
|
||||||
* @throws Exception if something goes wrong during candidate creation
|
* @throws Exception if something goes wrong during candidate creation
|
||||||
*/
|
*/
|
||||||
public UPNPCandidate createUPNPCandidate(DatagramSocket socket,
|
public List<LocalCandidate> createUPNPCandidate(DatagramSocket socket,
|
||||||
InetAddress localAddr, String externalIP, int port, Component cmp,
|
InetAddress localAddr, String externalIP, int port, Component cmp,
|
||||||
GatewayDevice device)
|
GatewayDevice device)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
List<LocalCandidate> ret = new ArrayList<LocalCandidate>();
|
||||||
TransportAddress addr = new TransportAddress(externalIP, port,
|
TransportAddress addr = new TransportAddress(externalIP, port,
|
||||||
Transport.UDP);
|
Transport.UDP);
|
||||||
|
|
||||||
@ -157,6 +167,9 @@ public class UPNPHarvester
|
|||||||
DatagramSocket stunSocket = candidate.getStunSocket(null);
|
DatagramSocket stunSocket = candidate.getStunSocket(null);
|
||||||
candidate.getStunStack().addSocket(stunSocket);
|
candidate.getStunStack().addSocket(stunSocket);
|
||||||
|
|
||||||
return candidate;
|
ret.add(candidate);
|
||||||
|
ret.add(base);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user