[Modify] Throw exception

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

View File

@ -880,8 +880,12 @@ namespace WebSocketSharp.Server
public void CloseSession (string id, ushort code, string reason) public void CloseSession (string id, ushort code, string reason)
{ {
IWebSocketSession session; IWebSocketSession session;
if (TryGetSession (id, out session)) if (!TryGetSession (id, out session)) {
session.Context.WebSocket.Close (code, reason); var msg = "The session could not be found.";
throw new ArgumentException (msg, "id");
}
session.Context.WebSocket.Close (code, reason);
} }
/// <summary> /// <summary>