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