|
|
|
|
@ -31,7 +31,8 @@
|
|
|
|
|
#region Contributors
|
|
|
|
|
/*
|
|
|
|
|
* Contributors:
|
|
|
|
|
* Juan Manuel Lallana <juan.manuel.lallana@gmail.com>
|
|
|
|
|
* - Juan Manuel Lallana <juan.manuel.lallana@gmail.com>
|
|
|
|
|
* - Jonas Hovgaard <j@jhovgaard.dk>
|
|
|
|
|
*/
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
@ -66,12 +67,12 @@ namespace WebSocketSharp.Server
|
|
|
|
|
private int _port;
|
|
|
|
|
private string _realm;
|
|
|
|
|
private Thread _receiveRequestThread;
|
|
|
|
|
private bool _reuseAddress;
|
|
|
|
|
private bool _secure;
|
|
|
|
|
private WebSocketServiceManager _services;
|
|
|
|
|
private volatile ServerState _state;
|
|
|
|
|
private object _sync;
|
|
|
|
|
private Uri _uri;
|
|
|
|
|
private bool _reuseAddress;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
@ -418,6 +419,36 @@ namespace WebSocketSharp.Server
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether the server is allowed to be bound to an address
|
|
|
|
|
/// that is already in use.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// If you would like to resolve to wait for socket in <c>TIME_WAIT</c> state, you should set
|
|
|
|
|
/// this property to <c>true</c>.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <value>
|
|
|
|
|
/// <c>true</c> if the server is allowed to be bound to an address that is already in use;
|
|
|
|
|
/// otherwise, <c>false</c>. The default value is <c>false</c>.
|
|
|
|
|
/// </value>
|
|
|
|
|
public bool ReuseAddress {
|
|
|
|
|
get {
|
|
|
|
|
return _reuseAddress;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set {
|
|
|
|
|
if (!canSet ("ReuseAddress"))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (value ^ _reuseAddress) {
|
|
|
|
|
_listener.Server.SetSocketOption (
|
|
|
|
|
SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, value);
|
|
|
|
|
|
|
|
|
|
_reuseAddress = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the delegate called to find the credentials for an identity used to
|
|
|
|
|
/// authenticate a client.
|
|
|
|
|
@ -452,39 +483,6 @@ namespace WebSocketSharp.Server
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets a value indicating whether the server is allowed to be bound to an address
|
|
|
|
|
/// that is already in use.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// If you would like to resolve to wait for socket <c>TIME_WAIT</c>, you should set this
|
|
|
|
|
/// property to <c>true</c>.
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <value>
|
|
|
|
|
/// <c>true</c> if the server is allowed to be bound to an address that is already in use;
|
|
|
|
|
/// otherwise, <c>false</c>. The default value is <c>false</c>.
|
|
|
|
|
/// </value>
|
|
|
|
|
public bool ReuseAddress
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return _reuseAddress;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (!canSet("ReuseAddress"))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (value ^ _reuseAddress)
|
|
|
|
|
{
|
|
|
|
|
_listener.Server.SetSocketOption(
|
|
|
|
|
SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, value);
|
|
|
|
|
|
|
|
|
|
_reuseAddress = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Private Methods
|
|
|
|
|
@ -874,6 +872,7 @@ namespace WebSocketSharp.Server
|
|
|
|
|
|
|
|
|
|
_state = ServerState.Stop;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|