[Modify] Throw exceptions
This commit is contained in:
parent
c1ea361e2e
commit
922cd7e3b4
@ -2773,16 +2773,14 @@ namespace WebSocketSharp
|
|||||||
/// </param>
|
/// </param>
|
||||||
public void SendAsync (byte[] data, Action<bool> completed)
|
public void SendAsync (byte[] data, Action<bool> completed)
|
||||||
{
|
{
|
||||||
var msg = _readyState.CheckIfAvailable (false, true, false, false) ??
|
if (_readyState != WebSocketState.Open) {
|
||||||
CheckSendParameter (data);
|
var msg = "The current state of the connection is not Open.";
|
||||||
|
throw new InvalidOperationException (msg);
|
||||||
if (msg != null) {
|
|
||||||
_logger.Error (msg);
|
|
||||||
error ("An error has occurred in sending data.", null);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
throw new ArgumentNullException ("data");
|
||||||
|
|
||||||
sendAsync (Opcode.Binary, new MemoryStream (data), completed);
|
sendAsync (Opcode.Binary, new MemoryStream (data), completed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user