From 97742b066704d5f3a8bb7931154e71e1f5bb3f52 Mon Sep 17 00:00:00 2001 From: sta Date: Tue, 23 Aug 2016 15:35:37 +0900 Subject: [PATCH] [Modify] Replace it --- websocket-sharp/WebSocket.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index ebb4ffe4..d9d60858 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -2322,10 +2322,15 @@ namespace WebSocketSharp /// public void Close (ushort code, string reason) { - var msg = _readyState.CheckIfAvailable (true, true, false, false) ?? - CheckCloseParameters (code, reason, _client); + string msg; + if (!checkIfAvailable (true, true, false, false, out msg)) { + _logger.Error (msg); + error ("An error has occurred in closing the connection.", null); - if (msg != null) { + return; + } + + if (!CheckParametersForClose (code, reason, _client, out msg)) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null);