Fix for issue #76, modified the access level of the WaitTime property of the WebSocket class to the public
This commit is contained in:
parent
e21e35c768
commit
aab7ef5a55
@ -317,7 +317,10 @@ namespace WebSocketSharp.Server
|
||||
_websocket = context.WebSocket;
|
||||
_websocket.CustomHandshakeRequestChecker = checkIfValidConnectionRequest;
|
||||
_websocket.Protocol = _protocol;
|
||||
_websocket.WaitTime = sessions.WaitTime;
|
||||
|
||||
var waitTime = sessions.WaitTime;
|
||||
if (waitTime != _websocket.WaitTime)
|
||||
_websocket.WaitTime = waitTime;
|
||||
|
||||
_websocket.OnOpen += onOpen;
|
||||
_websocket.OnMessage += onMessage;
|
||||
|
@ -226,16 +226,6 @@ namespace WebSocketSharp
|
||||
}
|
||||
}
|
||||
|
||||
internal TimeSpan WaitTime {
|
||||
get {
|
||||
return _waitTime;
|
||||
}
|
||||
|
||||
set {
|
||||
_waitTime = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
@ -481,6 +471,34 @@ namespace WebSocketSharp
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the wait time for the response to the Ping or Close.
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// A <see cref="TimeSpan"/> that represents the wait time. The default value is
|
||||
/// the same as 5 seconds, or 1 second if the <see cref="WebSocket"/> is used by
|
||||
/// a server.
|
||||
/// </value>
|
||||
public TimeSpan WaitTime {
|
||||
get {
|
||||
return _waitTime;
|
||||
}
|
||||
|
||||
set {
|
||||
lock (_forConn) {
|
||||
var msg = checkIfAvailable (true, false) ?? value.CheckIfValidWaitTime ();
|
||||
if (msg != null) {
|
||||
_logger.Error (msg);
|
||||
error ("An error has occurred in setting the wait time.", null);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
_waitTime = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Events
|
||||
@ -535,11 +553,11 @@ namespace WebSocketSharp
|
||||
return sendHttpResponse (createHandshakeResponse ());
|
||||
}
|
||||
|
||||
private string checkIfAvailable (bool availableAsServer, bool availableAsConnected)
|
||||
private string checkIfAvailable (bool asServer, bool asConnected)
|
||||
{
|
||||
return !_client && !availableAsServer
|
||||
return !_client && !asServer
|
||||
? "This operation isn't available as a server."
|
||||
: !availableAsConnected
|
||||
: !asConnected
|
||||
? _readyState.CheckIfConnectable ()
|
||||
: null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user