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

This commit is contained in:
sta 2012-07-31 16:42:34 +09:00
parent 118e0015d5
commit a93dcc09aa
6 changed files with 14 additions and 12 deletions

View File

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

Binary file not shown.