Fixed close(PayloadData data) method in websocket-sharp/WebSocket.cs

master
sta 14 years ago
parent 118e0015d5
commit a93dcc09aa

@ -226,23 +226,17 @@ namespace WebSocketSharp
{ {
return; return;
} }
else if (_readyState == WsState.CONNECTING)
if (OnClose != null)
{
OnClose(this, new CloseEventArgs(data));
}
if (_readyState == WsState.CONNECTING)
{ {
ReadyState = WsState.CLOSED; ReadyState = WsState.CLOSED;
emitOnClose(data);
return; return;
} }
else
{
ReadyState = WsState.CLOSING;
}
}
ReadyState = WsState.CLOSING;
}
emitOnClose(data);
var frame = new WsFrame(Opcode.CLOSE, data); var frame = new WsFrame(Opcode.CLOSE, data);
closeHandshake(frame); closeHandshake(frame);
#if DEBUG #if DEBUG
@ -434,6 +428,14 @@ namespace WebSocketSharp
ReadyState = WsState.OPEN; ReadyState = WsState.OPEN;
} }
private void emitOnClose(PayloadData data)
{
if (OnClose != null)
{
OnClose(this, new CloseEventArgs(data));
}
}
private void error(string message) private void error(string message)
{ {
var callerFrame = new StackFrame(1); var callerFrame = new StackFrame(1);

Loading…
Cancel
Save