[Modify] Throw exception

This commit is contained in:
sta 2017-08-16 11:46:12 +09:00
parent 26525b12f3
commit fcc27fd4e2

View File

@ -1216,11 +1216,17 @@ namespace WebSocketSharp.Server
/// the send is complete. A <see cref="bool"/> passed to this delegate is <c>true</c>
/// if the send is complete successfully.
/// </param>
public void SendToAsync (Stream stream, int length, string id, Action<bool> completed)
public void SendToAsync (
Stream stream, int length, string id, Action<bool> completed
)
{
IWebSocketSession session;
if (TryGetSession (id, out session))
session.Context.WebSocket.SendAsync (stream, length, completed);
if (!TryGetSession (id, out session)) {
var msg = "The session could not be found.";
throw new ArgumentException (msg, "id");
}
session.Context.WebSocket.SendAsync (stream, length, completed);
}
/// <summary>