|
|
|
@ -1052,14 +1052,17 @@ namespace WebSocketSharp.Server
|
|
|
|
/// </param>
|
|
|
|
/// </param>
|
|
|
|
public bool TryGetSession (string id, out IWebSocketSession session)
|
|
|
|
public bool TryGetSession (string id, out IWebSocketSession session)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var msg = _state.CheckIfAvailable (false, true, false) ?? id.CheckIfValidSessionID ();
|
|
|
|
if (_state != ServerState.Start) {
|
|
|
|
if (msg != null) {
|
|
|
|
var msg = "The current state of the manager is not Start.";
|
|
|
|
_logger.Error (msg);
|
|
|
|
throw new InvalidOperationException (msg);
|
|
|
|
session = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (id == null)
|
|
|
|
|
|
|
|
throw new ArgumentNullException ("id");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (id.Length == 0)
|
|
|
|
|
|
|
|
throw new ArgumentException ("An empty string.", "id");
|
|
|
|
|
|
|
|
|
|
|
|
return tryGetSession (id, out session);
|
|
|
|
return tryGetSession (id, out session);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|