Fix a few for WebSocket.cs
This commit is contained in:
parent
142fc2213d
commit
5bd88ee1a3
@ -1035,16 +1035,21 @@ namespace WebSocketSharp
|
|||||||
|
|
||||||
private void open ()
|
private void open ()
|
||||||
{
|
{
|
||||||
startReceiving ();
|
try {
|
||||||
|
startReceiving ();
|
||||||
|
|
||||||
lock (_forEvent) {
|
lock (_forEvent) {
|
||||||
try {
|
try {
|
||||||
OnOpen.Emit (this, EventArgs.Empty);
|
OnOpen.Emit (this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
acceptException (ex, "An exception has occurred while OnOpen.");
|
acceptException (ex, "An exception has occurred while OnOpen.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
acceptException (ex, "An exception has occurred while opening.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// As client
|
// As client
|
||||||
@ -1468,8 +1473,11 @@ namespace WebSocketSharp
|
|||||||
internal bool Ping (byte [] frame, int timeout)
|
internal bool Ping (byte [] frame, int timeout)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
var pong = _receivePong;
|
AutoResetEvent pong;
|
||||||
return _readyState == WebSocketState.Open && send (frame) && pong.WaitOne (timeout);
|
return _readyState == WebSocketState.Open &&
|
||||||
|
send (frame) &&
|
||||||
|
(pong = _receivePong) != null &&
|
||||||
|
pong.WaitOne (timeout);
|
||||||
}
|
}
|
||||||
catch (Exception ex) {
|
catch (Exception ex) {
|
||||||
_logger.Fatal ("An exception has occurred while Ping:\n" + ex.ToString ());
|
_logger.Fatal ("An exception has occurred while Ping:\n" + ex.ToString ());
|
||||||
|
Loading…
Reference in New Issue
Block a user