[Modify] Throw exceptions

master
sta 8 years ago
parent 9ad9d97466
commit 60a6a8d0b9

@ -468,14 +468,14 @@ namespace WebSocketSharp.Server
/// </param>
public void BroadcastAsync (byte[] data, Action completed)
{
var msg = _state.CheckIfAvailable (false, true, false) ??
WebSocket.CheckSendParameter (data);
if (msg != null) {
_logger.Error (msg);
return;
if (_state != ServerState.Start) {
var msg = "The current state of the manager is not Start.";
throw new InvalidOperationException (msg);
}
if (data == null)
throw new ArgumentNullException ("data");
if (data.LongLength <= WebSocket.FragmentLength)
broadcastAsync (Opcode.Binary, data, completed);
else

Loading…
Cancel
Save