resolves conflicts
This commit is contained in:
parent
995122b320
commit
68607664e1
@ -51,7 +51,7 @@ public abstract class AbstractStunCandidateHarvester
|
|||||||
/**
|
/**
|
||||||
* The stack to use for STUN communication.
|
* The stack to use for STUN communication.
|
||||||
*/
|
*/
|
||||||
private final StunStack stunStack = StunStack.getInstance();
|
protected final StunStack stunStack = StunStack.getInstance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new STUN harvester that will be running against the specified
|
* Creates a new STUN harvester that will be running against the specified
|
||||||
@ -110,7 +110,7 @@ public abstract class AbstractStunCandidateHarvester
|
|||||||
* @param base the <tt>HostCandidate</tt> that we should use as a base
|
* @param base the <tt>HostCandidate</tt> that we should use as a base
|
||||||
* for the new <tt>ServerReflexiveCandidate</tt>.
|
* for the new <tt>ServerReflexiveCandidate</tt>.
|
||||||
*/
|
*/
|
||||||
protected void createServerReflexiveCandidate(Message response,
|
protected void createServerReflexiveCandidate(Message response,
|
||||||
HostCandidate base)
|
HostCandidate base)
|
||||||
{
|
{
|
||||||
Attribute attribute
|
Attribute attribute
|
||||||
|
|||||||
@ -7,6 +7,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.ice4j.ice.harvest;
|
package org.ice4j.ice.harvest;
|
||||||
|
|
||||||
|
import java.net.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.logging.*;
|
||||||
|
|
||||||
import org.ice4j.*;
|
import org.ice4j.*;
|
||||||
import org.ice4j.ice.*;
|
import org.ice4j.ice.*;
|
||||||
import org.ice4j.message.*;
|
import org.ice4j.message.*;
|
||||||
@ -23,6 +27,12 @@ import org.ice4j.socket.*;
|
|||||||
public class StunCandidateHarvester
|
public class StunCandidateHarvester
|
||||||
extends AbstractStunCandidateHarvester
|
extends AbstractStunCandidateHarvester
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The <tt>Logger</tt> used by the <tt>StunCandidateHarvester</tt>
|
||||||
|
* class and its instances for logging output.
|
||||||
|
*/
|
||||||
|
private static final Logger logger
|
||||||
|
= Logger.getLogger(AbstractStunCandidateHarvester.class.getName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The <tt>DatagramPacketFilter</tt> which accepts only STUN messages
|
* The <tt>DatagramPacketFilter</tt> which accepts only STUN messages
|
||||||
@ -32,6 +42,13 @@ public class StunCandidateHarvester
|
|||||||
private static final StunDatagramPacketFilter stunDatagramPacketFilter
|
private static final StunDatagramPacketFilter stunDatagramPacketFilter
|
||||||
= new StunDatagramPacketFilter();
|
= new StunDatagramPacketFilter();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of candidates that this harvester has allocated and that it
|
||||||
|
* needs to keep alive.
|
||||||
|
*/
|
||||||
|
private List<ServerReflexiveCandidate> allocatedCandidates
|
||||||
|
= new LinkedList<ServerReflexiveCandidate>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new STUN harvester that will be running against the specified
|
* Creates a new STUN harvester that will be running against the specified
|
||||||
* <tt>stunServer</tt>.
|
* <tt>stunServer</tt>.
|
||||||
@ -81,4 +98,30 @@ public class StunCandidateHarvester
|
|||||||
{
|
{
|
||||||
return stunDatagramPacketFilter;
|
return stunDatagramPacketFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* reSends a binding request to our stun server through the specified
|
||||||
|
* <tt>srflxCand</tt> candidate so that it would keep the potential NAT
|
||||||
|
* mapping valid.
|
||||||
|
*
|
||||||
|
* @param srflxCand the <tt>ServerReflexiveCandidate</tt> that we'd like to
|
||||||
|
* refresh and keep alive.
|
||||||
|
*/
|
||||||
|
private void refreshCandidate(ServerReflexiveCandidate srflxCand)
|
||||||
|
{
|
||||||
|
DatagramSocket sock = srflxCand.getSocket();
|
||||||
|
stunStack.addSocket(sock);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
stunStack.sendRequest( MessageFactory.createBindingRequest(),
|
||||||
|
stunServer, sock, this);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
logger.log(Level.INFO, "Failed to send a refresh for a candidate",
|
||||||
|
exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user