feat: Removes the VIRTUAL_SOCKET_LAYER flag, enabling it
by default.
This commit is contained in:
parent
3ddb19ff2c
commit
91858ba6a3
@ -232,20 +232,6 @@ public class StackProperties
|
||||
public static final String USE_DYNAMIC_HOST_HARVESTER
|
||||
= "org.ice4j.ice.harvest.USE_DYNAMIC_HOST_HARVESTER";
|
||||
|
||||
/**
|
||||
* The name of the property which specifies whether the virtual socket
|
||||
* layer should be enabled.
|
||||
* WARNING: enabling the virtual socket layer will break applications which
|
||||
* use sockets from specific {@code CandidatePair}s in subtle and
|
||||
* potentially hard to debug ways. This should only be used by applications
|
||||
* that specifically want to use the virtual socket layer (i.e. use the
|
||||
* socket instance provided by the {@code Component}, and not a specific
|
||||
* {@code CandidatePair}).
|
||||
* This is currently EXPERIMENTAL.
|
||||
*/
|
||||
public static final String ENABLE_VIRTUAL_SOCKET_LAYER
|
||||
= "org.ice4j.ice.harvest.ENABLE_VIRTUAL_SOCKET_LAYER";
|
||||
|
||||
/**
|
||||
* Returns the String value of the specified property (minus all
|
||||
* encompassing whitespaces)and null in case no property value was mapped
|
||||
|
||||
@ -114,15 +114,6 @@ public class Agent
|
||||
public static final String PROPERTY_ICE_PROCESSING_STATE
|
||||
= "IceProcessingState";
|
||||
|
||||
/**
|
||||
* The flag which indicates whether the virtual socket layer should be
|
||||
* enabled or not.
|
||||
*/
|
||||
public static boolean ENABLE_VIRTUAL_SOCKET_LAYER
|
||||
= StackProperties.getBoolean(
|
||||
StackProperties.ENABLE_VIRTUAL_SOCKET_LAYER,
|
||||
false);
|
||||
|
||||
/**
|
||||
* The LinkedHashMap used to store the media streams
|
||||
* This map preserves the insertion order of the media streams.
|
||||
@ -385,8 +376,7 @@ public class Agent
|
||||
|
||||
if (logger.isLoggable(Level.FINE))
|
||||
{
|
||||
logger.fine("Created a new Agent, ufrag=" + ufrag
|
||||
+ ", VSL=" + ENABLE_VIRTUAL_SOCKET_LAYER);
|
||||
logger.fine("Created a new Agent, ufrag=" + ufrag);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -124,9 +124,7 @@ public class Component
|
||||
private final Logger logger;
|
||||
|
||||
/**
|
||||
* The {@link MergingDatagramSocket} instance which, if the virtual socket
|
||||
* layer is enabled (see
|
||||
* {@link StackProperties#ENABLE_VIRTUAL_SOCKET_LAYER}), will serve as the
|
||||
* The {@link MergingDatagramSocket} instance which will serve as the
|
||||
* single socket instance for this {@link Component}, merging received
|
||||
* packets from all of its candidates.
|
||||
*/
|
||||
@ -152,25 +150,17 @@ public class Component
|
||||
this.componentID = componentID;
|
||||
this.parentStream = mediaStream;
|
||||
|
||||
if (Agent.ENABLE_VIRTUAL_SOCKET_LAYER)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
mergingDatagramSocket = new MergingDatagramSocket();
|
||||
mergingDatagramSocketWrapper
|
||||
= new IceUdpSocketWrapper(
|
||||
new MultiplexingDatagramSocket(
|
||||
mergingDatagramSocket));
|
||||
}
|
||||
catch (SocketException se)
|
||||
{
|
||||
throw new RuntimeException(se);
|
||||
}
|
||||
mergingDatagramSocket = new MergingDatagramSocket();
|
||||
mergingDatagramSocketWrapper
|
||||
= new IceUdpSocketWrapper(
|
||||
new MultiplexingDatagramSocket(
|
||||
mergingDatagramSocket));
|
||||
}
|
||||
else
|
||||
catch (SocketException se)
|
||||
{
|
||||
mergingDatagramSocket = null;
|
||||
mergingDatagramSocketWrapper = null;
|
||||
throw new RuntimeException(se);
|
||||
}
|
||||
|
||||
logger
|
||||
@ -950,9 +940,7 @@ public class Component
|
||||
|
||||
/**
|
||||
* @return the single socket for this {@link Component} which should be
|
||||
* used for reading and writing data, if the virtual socket layer is enabled
|
||||
* (see {@link StackProperties#ENABLE_VIRTUAL_SOCKET_LAYER}), and
|
||||
* {@code null} if it is not enabled.
|
||||
* used for reading and writing data.
|
||||
*/
|
||||
public MergingDatagramSocket getSocket()
|
||||
{
|
||||
@ -961,12 +949,10 @@ public class Component
|
||||
|
||||
/**
|
||||
* @return an {@link IceSocketWrapper} instance wrapping the socket for this
|
||||
* candidate (see {@link #getSocket()}), if the virtual socket layer is
|
||||
* enabled (see {@link StackProperties#ENABLE_VIRTUAL_SOCKET_LAYER}), or
|
||||
* {@code null} if it is not enabled.
|
||||
* candidate (see {@link #getSocket()}).
|
||||
* @deprecated Use {@link #getSocket()} directly. This is only introduced
|
||||
* to ease the transition of applications which are already written to use
|
||||
* a {@link IceSocketWrapper} instance.
|
||||
* an {@link IceSocketWrapper} instance.
|
||||
*/
|
||||
@Deprecated
|
||||
public IceSocketWrapper getSocketWrapper()
|
||||
|
||||
@ -363,11 +363,7 @@ public class SinglePortUdpHarvester
|
||||
new TransportAddress(remoteAddress, Transport.UDP));
|
||||
|
||||
// TODO: maybe move this code to the candidates.
|
||||
MergingDatagramSocket componentSocket = component.getSocket();
|
||||
if (componentSocket != null)
|
||||
{
|
||||
componentSocket.add(multiplexing);
|
||||
}
|
||||
component.getSocket().add(multiplexing);
|
||||
|
||||
// XXX is this necessary?
|
||||
synchronized (candidateSockets)
|
||||
|
||||
@ -488,21 +488,11 @@ public class TcpHarvester
|
||||
IceProcessingState state
|
||||
= component.getParentStream().getParentAgent().getState();
|
||||
|
||||
if (!IceProcessingState.WAITING.equals(state)
|
||||
if (logger.isLoggable(Level.FINE)
|
||||
&& !IceProcessingState.WAITING.equals(state)
|
||||
&& !IceProcessingState.RUNNING.equals(state))
|
||||
{
|
||||
// If we are using the VSL, we can still make use of the socket.
|
||||
// Otherwise, we have no use for it, so we better close it (and
|
||||
// log a warning) early.
|
||||
if (!Agent.ENABLE_VIRTUAL_SOCKET_LAYER)
|
||||
{
|
||||
throw new IllegalStateException(
|
||||
"The associated Agent is in state " + state);
|
||||
}
|
||||
else if (logger.isLoggable(Level.FINE))
|
||||
{
|
||||
logger.fine("Adding a socket to an Agent in state " + state);
|
||||
}
|
||||
logger.fine("Adding a socket to an Agent in state " + state);
|
||||
}
|
||||
|
||||
// Socket to add to the candidate
|
||||
@ -530,11 +520,8 @@ public class TcpHarvester
|
||||
candidate.addSocket(candidateSocket);
|
||||
|
||||
// TODO: Maybe move this code to the candidate.
|
||||
MergingDatagramSocket componentSocket = component.getSocket();
|
||||
if (componentSocket != null)
|
||||
{
|
||||
componentSocket.add(multiplexing);
|
||||
}
|
||||
component.getSocket().add(multiplexing);
|
||||
|
||||
// the socket is not our responsibility anymore. It is up to
|
||||
// the candidate/component to close/free it.
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user