[Modify] Polish it
This commit is contained in:
parent
9bf71f2668
commit
ebdaecfd19
@ -1817,17 +1817,17 @@ namespace WebSocketSharp
|
|||||||
|
|
||||||
internal bool Ping (byte[] frameAsBytes, TimeSpan timeout)
|
internal bool Ping (byte[] frameAsBytes, TimeSpan timeout)
|
||||||
{
|
{
|
||||||
try {
|
if (_readyState != WebSocketState.Open)
|
||||||
AutoResetEvent pong;
|
|
||||||
return _readyState == WebSocketState.Open &&
|
|
||||||
send (frameAsBytes) &&
|
|
||||||
(pong = _receivePong) != null &&
|
|
||||||
pong.WaitOne (timeout);
|
|
||||||
}
|
|
||||||
catch (Exception ex) {
|
|
||||||
_logger.Error (ex.ToString ());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
if (!send (frameAsBytes))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var receivePong = _receivePong;
|
||||||
|
if (receivePong == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return receivePong.WaitOne (timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// As server, used to broadcast
|
// As server, used to broadcast
|
||||||
|
Loading…
Reference in New Issue
Block a user