diff --git a/websocket-sharp/Ext.cs b/websocket-sharp/Ext.cs index 1dfe3675..b08000fb 100644 --- a/websocket-sharp/Ext.cs +++ b/websocket-sharp/Ext.cs @@ -251,10 +251,11 @@ namespace WebSocketSharp : null; } - internal static string CheckIfValidPingData (this byte [] data) + internal static string CheckIfValidControlData ( + this byte [] data, string paramName) { return data.Length > 125 - ? "'message' length must be less." + ? String.Format ("'{0}' length must be less.", paramName) : null; } diff --git a/websocket-sharp/Server/WebSocketService.cs b/websocket-sharp/Server/WebSocketService.cs index 05cb26aa..d8c3c063 100644 --- a/websocket-sharp/Server/WebSocketService.cs +++ b/websocket-sharp/Server/WebSocketService.cs @@ -269,39 +269,6 @@ namespace WebSocketSharp.Server { } - /// - /// Sends a Ping to the client of the current - /// instance. - /// - /// - /// true if the current instance - /// receives a Pong from the client in a time; otherwise, false. - /// - protected bool Ping () - { - return _websocket != null - ? _websocket.Ping () - : false; - } - - /// - /// Sends a Ping with the specified to the client - /// of the current instance. - /// - /// - /// true if the current instance - /// receives a Pong from the client in a time; otherwise, false. - /// - /// - /// A that represents the message to send. - /// - protected bool Ping (string message) - { - return _websocket != null - ? _websocket.Ping (message) - : false; - } - /// /// Sends a binary to the client of the current /// instance. diff --git a/websocket-sharp/Server/WebSocketServiceHostManager.cs b/websocket-sharp/Server/WebSocketServiceHostManager.cs index 6e4c055d..36c55eed 100644 --- a/websocket-sharp/Server/WebSocketServiceHostManager.cs +++ b/websocket-sharp/Server/WebSocketServiceHostManager.cs @@ -672,7 +672,7 @@ namespace WebSocketSharp.Server byte [] data = null; var msg = _state.CheckIfStarted () ?? - (data = Encoding.UTF8.GetBytes (message)).CheckIfValidPingData (); + (data = Encoding.UTF8.GetBytes (message)).CheckIfValidControlData ("message"); if (msg != null) { _logger.Error (msg); diff --git a/websocket-sharp/Server/WebSocketSessionManager.cs b/websocket-sharp/Server/WebSocketSessionManager.cs index f5655cdb..9b20cad2 100644 --- a/websocket-sharp/Server/WebSocketSessionManager.cs +++ b/websocket-sharp/Server/WebSocketSessionManager.cs @@ -588,7 +588,7 @@ namespace WebSocketSharp.Server byte [] data = null; var msg = _state.CheckIfStarted () ?? - (data = Encoding.UTF8.GetBytes (message)).CheckIfValidPingData (); + (data = Encoding.UTF8.GetBytes (message)).CheckIfValidControlData ("message"); if (msg != null) { _logger.Error (msg); diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs index ba88bd96..82817b75 100644 --- a/websocket-sharp/WebSocket.cs +++ b/websocket-sharp/WebSocket.cs @@ -1437,10 +1437,9 @@ namespace WebSocketSharp return Convert.ToBase64String (src); } - internal bool Ping (byte [] frameAsBytes, int timeOut) + internal bool Ping (byte [] frame, int millisecondsTimeout) { - return send (frameAsBytes) && - _receivePong.WaitOne (timeOut); + return send (frame) && _receivePong.WaitOne (millisecondsTimeout); } // As server, used to broadcast @@ -1806,8 +1805,8 @@ namespace WebSocketSharp /// Sends a Ping using the WebSocket connection. /// /// - /// true if the instance receives a Pong in a time; - /// otherwise, false. + /// true if the instance receives the Pong to + /// this Ping from the server in a time; otherwise, false. /// public bool Ping () { @@ -1817,14 +1816,15 @@ namespace WebSocketSharp } /// - /// Sends a Ping with the specified using the WebSocket connection. + /// Sends a Ping with the specified using the + /// WebSocket connection. /// /// - /// A that contains a message to send. + /// A that represents the message to send. /// /// - /// true if the instance receives a Pong in a time; - /// otherwise, false. + /// true if the instance receives the Pong to + /// this Ping from the server in a time; otherwise, false. /// public bool Ping (string message) { @@ -1832,7 +1832,7 @@ namespace WebSocketSharp return Ping (); var data = Encoding.UTF8.GetBytes (message); - var msg = data.CheckIfValidPingData (); + var msg = data.CheckIfValidControlData ("message"); if (msg != null) { _logger.Error (msg); error (msg);