[Modify] Throw exception
This commit is contained in:
parent
26525b12f3
commit
fcc27fd4e2
@ -1216,11 +1216,17 @@ namespace WebSocketSharp.Server
|
|||||||
/// the send is complete. A <see cref="bool"/> passed to this delegate is <c>true</c>
|
/// the send is complete. A <see cref="bool"/> passed to this delegate is <c>true</c>
|
||||||
/// if the send is complete successfully.
|
/// if the send is complete successfully.
|
||||||
/// </param>
|
/// </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;
|
IWebSocketSession session;
|
||||||
if (TryGetSession (id, out session))
|
if (!TryGetSession (id, out session)) {
|
||||||
session.Context.WebSocket.SendAsync (stream, length, completed);
|
var msg = "The session could not be found.";
|
||||||
|
throw new ArgumentException (msg, "id");
|
||||||
|
}
|
||||||
|
|
||||||
|
session.Context.WebSocket.SendAsync (stream, length, completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user