From f780f536e2bb8a63fdb175a6059168e2e16d42f7 Mon Sep 17 00:00:00 2001 From: sta Date: Sun, 9 Aug 2015 11:27:42 +0900 Subject: [PATCH] Refactored a few for WebSocket.cs --- websocket-sharp/Ext.cs | 7 ------- websocket-sharp/WebSocket.cs | 16 ++++++++-------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 3dbc28ba..47b0d1e0 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -233,13 +233,6 @@ namespace WebSocketSharp : null; } - internal static string CheckIfConnectable (this WebSocketState state) - { - return state == WebSocketState.Open || state == WebSocketState.Closing - ? "A WebSocket connection has already been established." - : null; - } - internal static string CheckIfOpen (this WebSocketState state) { return state == WebSocketState.Connecting diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 2f83aadc..0d7061be 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -646,19 +646,19 @@ namespace WebSocketSharp return sendHttpResponse (createHandshakeResponse ()); } - private string checkIfAvailable (bool asServer, bool asConnected) + private string checkIfAvailable (bool server, bool connected) { - return !_client && !asServer - ? "This operation isn't available as a server." - : !asConnected - ? _readyState.CheckIfConnectable () + return !server && !_client + ? "This operation isn't available in the server." + : !connected && IsConnected + ? "This operation isn't available after the connection has been established." : null; } private string checkIfCanAccept () { return _client - ? "This operation isn't available as a client." + ? "This operation isn't available in the client." : _readyState.CheckIfCanAccept (); } @@ -1755,7 +1755,7 @@ namespace WebSocketSharp /// Accepts the WebSocket connection request. /// /// - /// This method isn't available as a client. + /// This method isn't available in the client. /// public void Accept () { @@ -1779,7 +1779,7 @@ namespace WebSocketSharp /// This method doesn't wait for the accept to be complete. /// /// - /// This method isn't available as a client. + /// This method isn't available in the client. /// /// public void AcceptAsync ()