[Modify] Throw exception

This commit is contained in:
sta 2017-08-18 14:27:13 +09:00
parent 0254b00b9e
commit 9a2dc74cbc

View File

@ -962,7 +962,11 @@ namespace WebSocketSharp.Server
public void CloseSession (string id, CloseStatusCode code, string reason) public void CloseSession (string id, CloseStatusCode code, string reason)
{ {
IWebSocketSession session; IWebSocketSession session;
if (TryGetSession (id, out session)) if (!TryGetSession (id, out session)) {
var msg = "The session could not be found.";
throw new ArgumentException (msg, "id");
}
session.Context.WebSocket.Close (code, reason); session.Context.WebSocket.Close (code, reason);
} }