aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-08 14:50:55 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-08 14:50:55 -0400
commit8398a5a32e98e5ae00e7f463b6ec009b1ef0c3e2 (patch)
tree557785da08d2a0bee287cb35d4ad244f72f4812d /MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
parent52ca9527cc00f2d6fc53aa2615070cf3e6990331 (diff)
close web socket gracefully to reduce error messages in server log
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
index 96f61912a..e96492317 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/NativeWebSocket.cs
@@ -88,6 +88,12 @@ namespace MediaBrowser.Server.Implementations.HttpServer
break;
}
+ if (bytes == null)
+ {
+ // Connection closed
+ break;
+ }
+
if (OnReceiveBytes != null)
{
OnReceiveBytes(bytes);
@@ -110,7 +116,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
if (result.CloseStatus.HasValue)
{
- throw new WebSocketException("Connection closed");
+ _logger.Info("Web socket connection closed.");
+ return null;
}
return buffer.Array;