[Modify] Throw exception
This commit is contained in:
parent
0254b00b9e
commit
9a2dc74cbc
@ -962,8 +962,12 @@ namespace WebSocketSharp.Server
|
||||
public void CloseSession (string id, CloseStatusCode code, string reason)
|
||||
{
|
||||
IWebSocketSession session;
|
||||
if (TryGetSession (id, out session))
|
||||
session.Context.WebSocket.Close (code, reason);
|
||||
if (!TryGetSession (id, out session)) {
|
||||
var msg = "The session could not be found.";
|
||||
throw new ArgumentException (msg, "id");
|
||||
}
|
||||
|
||||
session.Context.WebSocket.Close (code, reason);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user