Fix for issue #5

master
sta 14 years ago
parent 4613831582
commit ff94d551ff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -12,8 +12,8 @@ namespace Example2
wssv.Start(); wssv.Start();
Console.WriteLine( Console.WriteLine(
"WebSocket Server (url: {0})\n listening on address: {1} port: {2}\n", "WebSocket Server (url: {0}) listening on port: {1}\n",
wssv.Url, wssv.Address, wssv.Port); wssv.Url, wssv.Port);
Console.WriteLine("Press any key to stop server..."); Console.WriteLine("Press any key to stop server...");
Console.ReadLine(); Console.ReadLine();

Binary file not shown.

Binary file not shown.

@ -1,5 +1,5 @@
<Properties> <Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Release_Ubuntu" />
<MonoDevelop.Ide.Workbench /> <MonoDevelop.Ide.Workbench />
<MonoDevelop.Ide.DebuggingService.Breakpoints> <MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore /> <BreakpointStore />

@ -766,6 +766,21 @@ namespace WebSocketSharp
} }
} }
private void messageLoopCallback(IAsyncResult ar)
{
Action messageInvoker = (Action)ar.AsyncState;
messageInvoker.EndInvoke(ar);
if (_readyState == WsState.OPEN)
{
messageInvoker.BeginInvoke(messageLoopCallback, messageInvoker);
}
else
{
_autoEvent.Set();
}
}
private void pong(PayloadData data) private void pong(PayloadData data)
{ {
var frame = createFrame(Fin.FINAL, Opcode.PONG, data); var frame = createFrame(Fin.FINAL, Opcode.PONG, data);
@ -1090,27 +1105,14 @@ namespace WebSocketSharp
else else
{ {
_autoEvent = new AutoResetEvent(false); _autoEvent = new AutoResetEvent(false);
Action act = () => Action messageInvoker = () =>
{ {
if (_readyState == WsState.OPEN) if (_readyState == WsState.OPEN)
{ {
message(); message();
} }
}; };
AsyncCallback callback = (ar) => messageInvoker.BeginInvoke(messageLoopCallback, messageInvoker);
{
act.EndInvoke(ar);
if (_readyState == WsState.OPEN)
{
act.BeginInvoke(callback, null);
}
else
{
_autoEvent.Set();
}
};
act.BeginInvoke(callback, null);
} }
} }

Loading…
Cancel
Save