From d69f900c895ac33efb50a75f95041e8be7ea1c96 Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 10 Oct 2017 15:23:54 +0900 Subject: [PATCH] [Modify] Replace it --- websocket-sharp/WebSocket.cs | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 0ea9dfb6..2c094b1c 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -655,24 +655,15 @@ namespace WebSocketSharp if (value <= TimeSpan.Zero) throw new ArgumentOutOfRangeException ("value", "Zero or less."); - if (_readyState == WebSocketState.Open) { - _logger.Warn ("The connection has already been established."); - return; - } - - if (_readyState == WebSocketState.Closing) { - _logger.Warn ("The connection is closing."); + string msg; + if (!canSet (out msg)) { + _logger.Warn (msg); return; } lock (_forState) { - if (_readyState == WebSocketState.Open) { - _logger.Warn ("The connection has already been established."); - return; - } - - if (_readyState == WebSocketState.Closing) { - _logger.Warn ("The connection is closing."); + if (!canSet (out msg)) { + _logger.Warn (msg); return; }