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
|
public static final String USE_DYNAMIC_HOST_HARVESTER
|
||||||
= "org.ice4j.ice.harvest.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
|
* Returns the String value of the specified property (minus all
|
||||||
* encompassing whitespaces)and null in case no property value was mapped
|
* 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
|
public static final String PROPERTY_ICE_PROCESSING_STATE
|
||||||
= "IceProcessingState";
|
= "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
|
* The LinkedHashMap used to store the media streams
|
||||||
* This map preserves the insertion order of 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))
|
if (logger.isLoggable(Level.FINE))
|
||||||
{
|
{
|
||||||
logger.fine("Created a new Agent, ufrag=" + ufrag
|
logger.fine("Created a new Agent, ufrag=" + ufrag);
|
||||||
+ ", VSL=" + ENABLE_VIRTUAL_SOCKET_LAYER);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -124,9 +124,7 @@ public class Component
|
|||||||
private final Logger logger;
|
private final Logger logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The {@link MergingDatagramSocket} instance which, if the virtual socket
|
* The {@link MergingDatagramSocket} instance which will serve as the
|
||||||
* layer is enabled (see
|
|
||||||
* {@link StackProperties#ENABLE_VIRTUAL_SOCKET_LAYER}), will serve as the
|
|
||||||
* single socket instance for this {@link Component}, merging received
|
* single socket instance for this {@link Component}, merging received
|
||||||
* packets from all of its candidates.
|
* packets from all of its candidates.
|
||||||
*/
|
*/
|
||||||
@ -152,25 +150,17 @@ public class Component
|
|||||||
this.componentID = componentID;
|
this.componentID = componentID;
|
||||||
this.parentStream = mediaStream;
|
this.parentStream = mediaStream;
|
||||||
|
|
||||||
if (Agent.ENABLE_VIRTUAL_SOCKET_LAYER)
|
try
|
||||||
{
|
{
|
||||||
try
|
mergingDatagramSocket = new MergingDatagramSocket();
|
||||||
{
|
mergingDatagramSocketWrapper
|
||||||
mergingDatagramSocket = new MergingDatagramSocket();
|
= new IceUdpSocketWrapper(
|
||||||
mergingDatagramSocketWrapper
|
new MultiplexingDatagramSocket(
|
||||||
= new IceUdpSocketWrapper(
|
mergingDatagramSocket));
|
||||||
new MultiplexingDatagramSocket(
|
|
||||||
mergingDatagramSocket));
|
|
||||||
}
|
|
||||||
catch (SocketException se)
|
|
||||||
{
|
|
||||||
throw new RuntimeException(se);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
catch (SocketException se)
|
||||||
{
|
{
|
||||||
mergingDatagramSocket = null;
|
throw new RuntimeException(se);
|
||||||
mergingDatagramSocketWrapper = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger
|
logger
|
||||||
@ -950,9 +940,7 @@ public class Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the single socket for this {@link Component} which should be
|
* @return the single socket for this {@link Component} which should be
|
||||||
* used for reading and writing data, if the virtual socket layer is enabled
|
* used for reading and writing data.
|
||||||
* (see {@link StackProperties#ENABLE_VIRTUAL_SOCKET_LAYER}), and
|
|
||||||
* {@code null} if it is not enabled.
|
|
||||||
*/
|
*/
|
||||||
public MergingDatagramSocket getSocket()
|
public MergingDatagramSocket getSocket()
|
||||||
{
|
{
|
||||||
@ -961,12 +949,10 @@ public class Component
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return an {@link IceSocketWrapper} instance wrapping the socket for this
|
* @return an {@link IceSocketWrapper} instance wrapping the socket for this
|
||||||
* candidate (see {@link #getSocket()}), if the virtual socket layer is
|
* candidate (see {@link #getSocket()}).
|
||||||
* enabled (see {@link StackProperties#ENABLE_VIRTUAL_SOCKET_LAYER}), or
|
|
||||||
* {@code null} if it is not enabled.
|
|
||||||
* @deprecated Use {@link #getSocket()} directly. This is only introduced
|
* @deprecated Use {@link #getSocket()} directly. This is only introduced
|
||||||
* to ease the transition of applications which are already written to use
|
* to ease the transition of applications which are already written to use
|
||||||
* a {@link IceSocketWrapper} instance.
|
* an {@link IceSocketWrapper} instance.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public IceSocketWrapper getSocketWrapper()
|
public IceSocketWrapper getSocketWrapper()
|
||||||
|
|||||||
@ -363,11 +363,7 @@ public class SinglePortUdpHarvester
|
|||||||
new TransportAddress(remoteAddress, Transport.UDP));
|
new TransportAddress(remoteAddress, Transport.UDP));
|
||||||
|
|
||||||
// TODO: maybe move this code to the candidates.
|
// TODO: maybe move this code to the candidates.
|
||||||
MergingDatagramSocket componentSocket = component.getSocket();
|
component.getSocket().add(multiplexing);
|
||||||
if (componentSocket != null)
|
|
||||||
{
|
|
||||||
componentSocket.add(multiplexing);
|
|
||||||
}
|
|
||||||
|
|
||||||
// XXX is this necessary?
|
// XXX is this necessary?
|
||||||
synchronized (candidateSockets)
|
synchronized (candidateSockets)
|
||||||
|
|||||||
@ -488,21 +488,11 @@ public class TcpHarvester
|
|||||||
IceProcessingState state
|
IceProcessingState state
|
||||||
= component.getParentStream().getParentAgent().getState();
|
= component.getParentStream().getParentAgent().getState();
|
||||||
|
|
||||||
if (!IceProcessingState.WAITING.equals(state)
|
if (logger.isLoggable(Level.FINE)
|
||||||
|
&& !IceProcessingState.WAITING.equals(state)
|
||||||
&& !IceProcessingState.RUNNING.equals(state))
|
&& !IceProcessingState.RUNNING.equals(state))
|
||||||
{
|
{
|
||||||
// If we are using the VSL, we can still make use of the socket.
|
logger.fine("Adding a socket to an Agent in state " + state);
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Socket to add to the candidate
|
// Socket to add to the candidate
|
||||||
@ -530,11 +520,8 @@ public class TcpHarvester
|
|||||||
candidate.addSocket(candidateSocket);
|
candidate.addSocket(candidateSocket);
|
||||||
|
|
||||||
// TODO: Maybe move this code to the candidate.
|
// TODO: Maybe move this code to the candidate.
|
||||||
MergingDatagramSocket componentSocket = component.getSocket();
|
component.getSocket().add(multiplexing);
|
||||||
if (componentSocket != null)
|
|
||||||
{
|
|
||||||
componentSocket.add(multiplexing);
|
|
||||||
}
|
|
||||||
// the socket is not our responsibility anymore. It is up to
|
// the socket is not our responsibility anymore. It is up to
|
||||||
// the candidate/component to close/free it.
|
// the candidate/component to close/free it.
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user