[Modify] Polish it

This commit is contained in:
sta 2017-09-11 17:24:11 +09:00
parent 29c6bb4745
commit 544df68e13

View File

@ -240,13 +240,17 @@ namespace WebSocketSharp.Server
/// </value> /// </value>
public IEnumerable<IWebSocketSession> Sessions { public IEnumerable<IWebSocketSession> Sessions {
get { get {
if (_state == ServerState.ShuttingDown) if (_state != ServerState.Start)
return new IWebSocketSession[0]; return Enumerable.Empty<IWebSocketSession> ();
lock (_sync) {
if (_state != ServerState.Start)
return Enumerable.Empty<IWebSocketSession> ();
lock (_sync)
return _sessions.Values.ToList (); return _sessions.Values.ToList ();
} }
} }
}
/// <summary> /// <summary>
/// Gets the wait time for the response to the WebSocket Ping or Close. /// Gets the wait time for the response to the WebSocket Ping or Close.