[Modify] Throw exception

This commit is contained in:
sta 2017-08-18 14:02:28 +09:00
parent 814b64e019
commit 189d8b38ec

View File

@ -880,7 +880,11 @@ namespace WebSocketSharp.Server
public void CloseSession (string id, ushort code, string reason)
{
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);
}