close web socket gracefully to reduce error messages in server log

This commit is contained in:
Luke Pulverenti
2013-09-08 14:50:55 -04:00
parent 52ca9527cc
commit 8398a5a32e
3 changed files with 27 additions and 10 deletions

View File

@@ -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;