From 65f51fa1ed39b3ad52dbd57019a12f505a446f77 Mon Sep 17 00:00:00 2001 From: sta Date: Mon, 22 Aug 2016 16:18:45 +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 179fcc20..0e0f6ded 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -2255,10 +2255,15 @@ namespace WebSocketSharp /// public void Close (ushort code) { - var msg = _readyState.CheckIfAvailable (true, true, false, false) ?? - CheckCloseParameters (code, null, _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, null, _client, out msg)) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null);