From 8398a5a32e98e5ae00e7f463b6ec009b1ef0c3e2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 8 Sep 2013 14:50:55 -0400 Subject: close web socket gracefully to reduce error messages in server log --- .../HttpServer/NativeWebSocket.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/HttpServer') 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; -- cgit v1.2.3