feat: Allow useDynamicPorts to be set per-Agent.
This commit is contained in:
parent
2e43ba1b3e
commit
fc1498ef7e
@ -301,6 +301,11 @@ public class Agent
|
|||||||
*/
|
*/
|
||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether this {@link Agent} should use dynamic ports. Can be overridden via {@link #setUseDynamicPorts(boolean)}.
|
||||||
|
*/
|
||||||
|
private boolean useDynamicPorts = HarvestConfig.config.useDynamicPorts();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an empty <tt>Agent</tt> with no streams, and no address.
|
* Creates an empty <tt>Agent</tt> with no streams, and no address.
|
||||||
*/
|
*/
|
||||||
@ -574,6 +579,14 @@ public class Agent
|
|||||||
return new CandidatePair(local, remote);
|
return new CandidatePair(local, remote);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the flag for whether this {@link Agent} instance should use dynamic ports.
|
||||||
|
*/
|
||||||
|
public void setUseDynamicPorts(boolean value)
|
||||||
|
{
|
||||||
|
useDynamicPorts = value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses all <tt>CandidateHarvester</tt>s currently registered with this
|
* Uses all <tt>CandidateHarvester</tt>s currently registered with this
|
||||||
* <tt>Agent</tt> to obtain whatever addresses they can discover.
|
* <tt>Agent</tt> to obtain whatever addresses they can discover.
|
||||||
@ -607,7 +620,7 @@ public class Agent
|
|||||||
logger.info("Gathering candidates for component " +
|
logger.info("Gathering candidates for component " +
|
||||||
component.toShortString() +".");
|
component.toShortString() +".");
|
||||||
|
|
||||||
if (HarvestConfig.config.useDynamicPorts())
|
if (useDynamicPorts)
|
||||||
{
|
{
|
||||||
hostCandidateHarvester.harvest(
|
hostCandidateHarvester.harvest(
|
||||||
component,
|
component,
|
||||||
|
|||||||
@ -38,7 +38,8 @@ ice4j {
|
|||||||
// The size in bytes to set on the UDP socket (SO_RCVBUF). If not specified, the default from the OS will be used.
|
// The size in bytes to set on the UDP socket (SO_RCVBUF). If not specified, the default from the OS will be used.
|
||||||
#receive-buffer-size = 10485760
|
#receive-buffer-size = 10485760
|
||||||
|
|
||||||
// Whether to allocate ephemeral ports for local candidates.
|
// Whether to allocate ephemeral ports for local candidates. This is the default value, and can be overridden
|
||||||
|
// for Agent instances.
|
||||||
use-dynamic-ports = true
|
use-dynamic-ports = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user