[Modify] Throw exceptions
This commit is contained in:
parent
09e803ffd7
commit
00348958cf
@ -2664,14 +2664,12 @@ namespace WebSocketSharp
|
||||
/// </param>
|
||||
public void Send (byte[] data)
|
||||
{
|
||||
var msg = _readyState.CheckIfAvailable (false, true, false, false) ??
|
||||
CheckSendParameter (data);
|
||||
if (data == null)
|
||||
throw new ArgumentNullException ("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);
|
||||
}
|
||||
|
||||
send (Opcode.Binary, new MemoryStream (data));
|
||||
|
Loading…
Reference in New Issue
Block a user