From 531eefac179254e1518eafb79a218e81e7a08ade Mon Sep 17 00:00:00 2001 From: sta Date: Mon, 4 May 2015 15:48:18 +0900 Subject: [PATCH] Renamed the CheckIfValidCloseParameters methods to the CheckCloseParameters methods --- websocket-sharp/Server/HttpServer.cs | 8 ++--- websocket-sharp/Server/WebSocketServer.cs | 8 ++--- websocket-sharp/WebSocket.cs | 37 ++++++----------------- 3 files changed, 14 insertions(+), 39 deletions(-) diff --git a/websocket-sharp/Server/HttpServer.cs b/websocket-sharp/Server/HttpServer.cs index 86b0539b..c078e549 100644 --- a/websocket-sharp/Server/HttpServer.cs +++ b/websocket-sharp/Server/HttpServer.cs @@ -757,9 +757,7 @@ namespace WebSocketSharp.Server public void Stop (ushort code, string reason) { lock (_sync) { - var msg = _state.CheckIfStart () ?? - WebSocket.CheckIfValidCloseParameters (code, reason, false); - + var msg = _state.CheckIfStart () ?? WebSocket.CheckCloseParameters (code, reason, false); if (msg != null) { _logger.Error (msg); return; @@ -795,9 +793,7 @@ namespace WebSocketSharp.Server public void Stop (CloseStatusCode code, string reason) { lock (_sync) { - var msg = _state.CheckIfStart () ?? - WebSocket.CheckIfValidCloseParameters (code, reason, false); - + var msg = _state.CheckIfStart () ?? WebSocket.CheckCloseParameters (code, reason, false); if (msg != null) { _logger.Error (msg); return; diff --git a/websocket-sharp/Server/WebSocketServer.cs b/websocket-sharp/Server/WebSocketServer.cs index a1b42b1b..3c2b18d9 100644 --- a/websocket-sharp/Server/WebSocketServer.cs +++ b/websocket-sharp/Server/WebSocketServer.cs @@ -842,9 +842,7 @@ namespace WebSocketSharp.Server public void Stop (ushort code, string reason) { lock (_sync) { - var msg = _state.CheckIfStart () ?? - WebSocket.CheckIfValidCloseParameters (code, reason, false); - + var msg = _state.CheckIfStart () ?? WebSocket.CheckCloseParameters (code, reason, false); if (msg != null) { _logger.Error (msg); return; @@ -879,9 +877,7 @@ namespace WebSocketSharp.Server public void Stop (CloseStatusCode code, string reason) { lock (_sync) { - var msg = _state.CheckIfStart () ?? - WebSocket.CheckIfValidCloseParameters (code, reason, false); - + var msg = _state.CheckIfStart () ?? WebSocket.CheckCloseParameters (code, reason, false); if (msg != null) { _logger.Error (msg); return; diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index 0d0c8892..7468f056 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -1560,7 +1560,7 @@ namespace WebSocketSharp #region Internal Methods - internal static string CheckIfValidCloseParameters (ushort code, string reason, bool client) + internal static string CheckCloseParameters (ushort code, string reason, bool client) { return !code.IsCloseStatusCode () ? "An invalid close status code." @@ -1575,8 +1575,7 @@ namespace WebSocketSharp : null; } - internal static string CheckIfValidCloseParameters ( - CloseStatusCode code, string reason, bool client) + internal static string CheckCloseParameters (CloseStatusCode code, string reason, bool client) { return code == CloseStatusCode.NoStatus ? (!reason.IsNullOrEmpty () ? "NoStatus cannot have a reason." : null) @@ -1767,9 +1766,7 @@ namespace WebSocketSharp /// public void Close (ushort code) { - var msg = _readyState.CheckIfClosable () ?? - CheckIfValidCloseParameters (code, null, _client); - + var msg = _readyState.CheckIfClosable () ?? CheckCloseParameters (code, null, _client); if (msg != null) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null); @@ -1796,9 +1793,7 @@ namespace WebSocketSharp /// public void Close (CloseStatusCode code) { - var msg = _readyState.CheckIfClosable () ?? - CheckIfValidCloseParameters (code, null, _client); - + var msg = _readyState.CheckIfClosable () ?? CheckCloseParameters (code, null, _client); if (msg != null) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null); @@ -1832,9 +1827,7 @@ namespace WebSocketSharp /// public void Close (ushort code, string reason) { - var msg = _readyState.CheckIfClosable () ?? - CheckIfValidCloseParameters (code, reason, _client); - + var msg = _readyState.CheckIfClosable () ?? CheckCloseParameters (code, reason, _client); if (msg != null) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null); @@ -1868,9 +1861,7 @@ namespace WebSocketSharp /// public void Close (CloseStatusCode code, string reason) { - var msg = _readyState.CheckIfClosable () ?? - CheckIfValidCloseParameters (code, reason, _client); - + var msg = _readyState.CheckIfClosable () ?? CheckCloseParameters (code, reason, _client); if (msg != null) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null); @@ -1924,9 +1915,7 @@ namespace WebSocketSharp /// public void CloseAsync (ushort code) { - var msg = _readyState.CheckIfClosable () ?? - CheckIfValidCloseParameters (code, null, _client); - + var msg = _readyState.CheckIfClosable () ?? CheckCloseParameters (code, null, _client); if (msg != null) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null); @@ -1956,9 +1945,7 @@ namespace WebSocketSharp /// public void CloseAsync (CloseStatusCode code) { - var msg = _readyState.CheckIfClosable () ?? - CheckIfValidCloseParameters (code, null, _client); - + var msg = _readyState.CheckIfClosable () ?? CheckCloseParameters (code, null, _client); if (msg != null) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null); @@ -1997,9 +1984,7 @@ namespace WebSocketSharp /// public void CloseAsync (ushort code, string reason) { - var msg = _readyState.CheckIfClosable () ?? - CheckIfValidCloseParameters (code, reason, _client); - + var msg = _readyState.CheckIfClosable () ?? CheckCloseParameters (code, reason, _client); if (msg != null) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null); @@ -2039,9 +2024,7 @@ namespace WebSocketSharp /// public void CloseAsync (CloseStatusCode code, string reason) { - var msg = _readyState.CheckIfClosable () ?? - CheckIfValidCloseParameters (code, reason, _client); - + var msg = _readyState.CheckIfClosable () ?? CheckCloseParameters (code, reason, _client); if (msg != null) { _logger.Error (msg); error ("An error has occurred in closing the connection.", null);