[Modify] Throw exceptions

This commit is contained in:
sta 2017-04-02 17:47:43 +09:00
parent b22a230367
commit d5fa6ad611

View File

@ -609,14 +609,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