Merged enix's fix (THX enix) and made a little change (because close method dose not work).

This commit is contained in:
sta 2011-06-05 17:39:43 +09:00
parent ab1f09283b
commit fc6ee2db12
25 changed files with 13 additions and 10 deletions

View File

@ -1,8 +1,8 @@
<Properties> <Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Release_Ubuntu" ctype="Workspace" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Release" ctype="Workspace" />
<MonoDevelop.Ide.Workbench ActiveDocument="websocket-sharp/WebSocket.cs" ctype="Workbench"> <MonoDevelop.Ide.Workbench ActiveDocument="websocket-sharp/WebSocket.cs" ctype="Workbench">
<Files> <Files>
<File FileName="websocket-sharp/WebSocket.cs" Line="282" Column="1" /> <File FileName="websocket-sharp/WebSocket.cs" Line="80" Column="19" />
</Files> </Files>
</MonoDevelop.Ide.Workbench> </MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints> <MonoDevelop.Ide.DebuggingService.Breakpoints>

View File

@ -53,6 +53,8 @@ namespace WebSocketSharp
get { return uri.ToString(); } get { return uri.ToString(); }
} }
private Object sync = new Object();
private volatile WsState readyState; private volatile WsState readyState;
public WsState ReadyState public WsState ReadyState
{ {
@ -63,17 +65,18 @@ namespace WebSocketSharp
switch (value) switch (value)
{ {
case WsState.OPEN: case WsState.OPEN:
readyState = value;
if (OnOpen != null) if (OnOpen != null)
{ {
OnOpen(this, EventArgs.Empty); OnOpen(this, EventArgs.Empty);
} }
goto default; break;
case WsState.CLOSING: case WsState.CLOSING:
case WsState.CLOSED: case WsState.CLOSED:
close(value); lock(sync)
break; {
default: close(value);
readyState = value; }
break; break;
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,11 +14,11 @@ namespace Example
//using (WebSocket ws = new WebSocket("ws://localhost:8000/")) //using (WebSocket ws = new WebSocket("ws://localhost:8000/"))
using (WebSocket ws = new WebSocket("ws://localhost:8000/", "chat")) using (WebSocket ws = new WebSocket("ws://localhost:8000/", "chat"))
{ {
/*ws.OnOpen += (o, e) => ws.OnOpen += (o, e) =>
{ {
//Do something. ws.Send("Hi, all!");
}; };
*/
ws.OnMessage += (o, s) => ws.OnMessage += (o, s) =>
{ {
#if NOTIFY #if NOTIFY

Binary file not shown.