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