Controls the use of the dynamic host harvester with a property instead
of an API call.
This commit is contained in:
parent
61d82e0885
commit
ab81b469af
@ -178,6 +178,13 @@ public class StackProperties
|
||||
public static final String BLOCKED_ADDRESSES
|
||||
= "org.ice4j.ice.harvest.BLOCKED_ADDRESSES";
|
||||
|
||||
/**
|
||||
* The name of the property which specifies whether the dynamic port UDP
|
||||
* host harvester should be used by <tt>Agent</tt> instances.
|
||||
*/
|
||||
public static final String USE_DYNAMIC_HOST_HARVESTER
|
||||
= "org.ice4j.ice.harvest.USE_DYNAMIC_HOST_HARVESTER";
|
||||
|
||||
/**
|
||||
* Returns the String value of the specified property (minus all
|
||||
* encompassing whitespaces)and null in case no property value was mapped
|
||||
|
||||
@ -267,7 +267,7 @@ public class Agent
|
||||
* The flag which specifies whether {@link #hostCandidateHarvester} should
|
||||
* be used or not.
|
||||
*/
|
||||
private boolean useHostHarvester = true;
|
||||
private Boolean useHostHarvester = null;
|
||||
|
||||
/**
|
||||
* Creates an empty <tt>Agent</tt> with no streams, and no address.
|
||||
@ -427,7 +427,7 @@ public class Agent
|
||||
logger.info("Gather candidates for component " +
|
||||
component.toShortString());
|
||||
|
||||
if (useHostHarvester)
|
||||
if (useHostHarvester())
|
||||
{
|
||||
hostCandidateHarvester.harvest(
|
||||
component,
|
||||
@ -2460,25 +2460,20 @@ public class Agent
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether using the dynamic UDP host harvester is enabled or not.
|
||||
*
|
||||
* @return <tt>true</tt> if using the dynamic UDP host harvester is enabled.
|
||||
* Checks whether the dynamic host harvester should be used or not.
|
||||
* @return <tt>true</tt> if the dynamic host harvester should be used and
|
||||
* <tt>false</tt> otherwise.
|
||||
*/
|
||||
public boolean dynamicHostHarvesterEnabled()
|
||||
private boolean useHostHarvester()
|
||||
{
|
||||
if (useHostHarvester == null)
|
||||
{
|
||||
useHostHarvester
|
||||
= StackProperties.getBoolean(
|
||||
StackProperties.USE_DYNAMIC_HOST_HARVESTER,
|
||||
true);
|
||||
}
|
||||
|
||||
return useHostHarvester;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the flag to enable or disable the dynamic UDP host harvester.
|
||||
* Note: to have the desired effect this needs to be called before any
|
||||
* any <tt>Component</tt>s are created using
|
||||
* {@link #createComponent(IceMediaStream, org.ice4j.Transport, int, int, int)}
|
||||
* @param enable the value to set.
|
||||
*/
|
||||
public void enableDynamicHostHarvester(boolean enable)
|
||||
{
|
||||
this.useHostHarvester = enable;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user