diff --git a/websocket-sharp.userprefs b/websocket-sharp.userprefs
index 3733385d..3d83015a 100644
--- a/websocket-sharp.userprefs
+++ b/websocket-sharp.userprefs
@@ -2,7 +2,7 @@
-
+
diff --git a/websocket-sharp/WebSocket.cs b/websocket-sharp/WebSocket.cs
index af88a1b2..1f4825f3 100644
--- a/websocket-sharp/WebSocket.cs
+++ b/websocket-sharp/WebSocket.cs
@@ -219,17 +219,15 @@ namespace WebSocketSharp
}
catch (Exception e)
{
+ if (OnError != null)
+ {
+ OnError(this, e.Message);
+ }
#if DEBUG
Console.WriteLine("WS: Error @close: {0}", e.Message);
#endif
}
}
-
- if (!(Thread.CurrentThread.IsBackground) &&
- msgThread != null && msgThread.IsAlive)
- {
- msgThread.Join();
- }
if (wsStream != null)
{
@@ -363,14 +361,11 @@ namespace WebSocketSharp
#endif
while (readyState == WsState.OPEN)
{
- while (readyState == WsState.OPEN && netStream.DataAvailable)
- {
- data = receive();
+ data = receive();
- if (OnMessage != null && data != null)
- {
- OnMessage(this, data);
- }
+ if (OnMessage != null && data != null)
+ {
+ OnMessage(this, data);
}
}
#if DEBUG
@@ -433,15 +428,18 @@ namespace WebSocketSharp
}
catch (Exception e)
{
- if (OnError != null)
+ if (readyState == WsState.OPEN)
{
- OnError(this, e.Message);
- }
+ if (OnError != null)
+ {
+ OnError(this, e.Message);
+ }
- ReadyState = WsState.CLOSED;
+ ReadyState = WsState.CLOSING;
#if DEBUG
- Console.WriteLine("WS: Error @receive: {0}", e.Message);
+ Console.WriteLine("WS: Error @receive: {0}", e.Message);
#endif
+ }
}
return null;
diff --git a/websocket-sharp/bin/Debug/websocket-sharp.dll b/websocket-sharp/bin/Debug/websocket-sharp.dll
index baf4357b..90a5d442 100755
Binary files a/websocket-sharp/bin/Debug/websocket-sharp.dll and b/websocket-sharp/bin/Debug/websocket-sharp.dll differ
diff --git a/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb b/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb
index 55fec09a..c01167da 100644
Binary files a/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb and b/websocket-sharp/bin/Debug/websocket-sharp.dll.mdb differ
diff --git a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll
index 136168f1..1cc62db8 100755
Binary files a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll and b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll differ
diff --git a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb
index 1e0f6326..1124d228 100644
Binary files a/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/websocket-sharp/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ
diff --git a/websocket-sharp/bin/Release/websocket-sharp.dll b/websocket-sharp/bin/Release/websocket-sharp.dll
index 7ee48987..3420284b 100755
Binary files a/websocket-sharp/bin/Release/websocket-sharp.dll and b/websocket-sharp/bin/Release/websocket-sharp.dll differ
diff --git a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll
index 4b1b818f..9dc706d5 100755
Binary files a/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll and b/websocket-sharp/bin/Release_Ubuntu/websocket-sharp.dll differ
diff --git a/websocket-sharp/websocket-sharp.pidb b/websocket-sharp/websocket-sharp.pidb
index e9fd417f..a66e68a7 100644
Binary files a/websocket-sharp/websocket-sharp.pidb and b/websocket-sharp/websocket-sharp.pidb differ
diff --git a/wsclient/bin/Debug/websocket-sharp.dll b/wsclient/bin/Debug/websocket-sharp.dll
index baf4357b..90a5d442 100755
Binary files a/wsclient/bin/Debug/websocket-sharp.dll and b/wsclient/bin/Debug/websocket-sharp.dll differ
diff --git a/wsclient/bin/Debug/websocket-sharp.dll.mdb b/wsclient/bin/Debug/websocket-sharp.dll.mdb
index 55fec09a..c01167da 100644
Binary files a/wsclient/bin/Debug/websocket-sharp.dll.mdb and b/wsclient/bin/Debug/websocket-sharp.dll.mdb differ
diff --git a/wsclient/bin/Debug/wsclient.exe b/wsclient/bin/Debug/wsclient.exe
index 243c1bab..3166e191 100755
Binary files a/wsclient/bin/Debug/wsclient.exe and b/wsclient/bin/Debug/wsclient.exe differ
diff --git a/wsclient/bin/Debug/wsclient.exe.mdb b/wsclient/bin/Debug/wsclient.exe.mdb
index a5bea852..2d0e9aaa 100644
Binary files a/wsclient/bin/Debug/wsclient.exe.mdb and b/wsclient/bin/Debug/wsclient.exe.mdb differ
diff --git a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll
index 136168f1..1cc62db8 100755
Binary files a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll and b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll differ
diff --git a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb
index 1e0f6326..1124d228 100644
Binary files a/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb and b/wsclient/bin/Debug_Ubuntu/websocket-sharp.dll.mdb differ
diff --git a/wsclient/bin/Debug_Ubuntu/wsclient.exe b/wsclient/bin/Debug_Ubuntu/wsclient.exe
index fef2dbe8..e57d8d45 100755
Binary files a/wsclient/bin/Debug_Ubuntu/wsclient.exe and b/wsclient/bin/Debug_Ubuntu/wsclient.exe differ
diff --git a/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb b/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb
index b9a1a2a0..ca651f6a 100644
Binary files a/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb and b/wsclient/bin/Debug_Ubuntu/wsclient.exe.mdb differ
diff --git a/wsclient/bin/Release/websocket-sharp.dll b/wsclient/bin/Release/websocket-sharp.dll
index 7ee48987..3420284b 100755
Binary files a/wsclient/bin/Release/websocket-sharp.dll and b/wsclient/bin/Release/websocket-sharp.dll differ
diff --git a/wsclient/bin/Release/wsclient.exe b/wsclient/bin/Release/wsclient.exe
index 16ae09ed..e5a8c5a3 100755
Binary files a/wsclient/bin/Release/wsclient.exe and b/wsclient/bin/Release/wsclient.exe differ
diff --git a/wsclient/bin/Release_Ubuntu/websocket-sharp.dll b/wsclient/bin/Release_Ubuntu/websocket-sharp.dll
index 4b1b818f..9dc706d5 100755
Binary files a/wsclient/bin/Release_Ubuntu/websocket-sharp.dll and b/wsclient/bin/Release_Ubuntu/websocket-sharp.dll differ
diff --git a/wsclient/bin/Release_Ubuntu/wsclient.exe b/wsclient/bin/Release_Ubuntu/wsclient.exe
index 1edccd66..2ed2c583 100755
Binary files a/wsclient/bin/Release_Ubuntu/wsclient.exe and b/wsclient/bin/Release_Ubuntu/wsclient.exe differ