aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/WebSockets/WebSocketManager.cs
diff options
context:
space:
mode:
authorClaus Vium <clausvium@gmail.com>2019-03-03 08:29:23 +0100
committerClaus Vium <clausvium@gmail.com>2019-03-03 08:29:23 +0100
commite823c11b46ccf0473aa72cb52cd5a3a9f977e61b (patch)
treec8b053828dece3d44defe2256d33039bd7fd22ed /Emby.Server.Implementations/WebSockets/WebSocketManager.cs
parent6bdb5debd2492b71d11f9628889b8c29b6321a77 (diff)
Add certificate to https and minor cleanup
Diffstat (limited to 'Emby.Server.Implementations/WebSockets/WebSocketManager.cs')
-rw-r--r--Emby.Server.Implementations/WebSockets/WebSocketManager.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/WebSockets/WebSocketManager.cs b/Emby.Server.Implementations/WebSockets/WebSocketManager.cs
index 888f2f0fc..5db2c8da7 100644
--- a/Emby.Server.Implementations/WebSockets/WebSocketManager.cs
+++ b/Emby.Server.Implementations/WebSockets/WebSocketManager.cs
@@ -35,6 +35,7 @@ namespace Emby.Server.Implementations.WebSockets
WebSocketReceiveResult result;
var message = new List<byte>();
+ // Keep listening for incoming messages, otherwise the socket closes automatically
do
{
var buffer = WebSocket.CreateServerBuffer(BufferSize);
@@ -57,7 +58,7 @@ namespace Emby.Server.Implementations.WebSockets
}
}
- public async Task ProcessMessage(byte[] messageBytes, TaskCompletionSource<bool> taskCompletionSource)
+ private async Task ProcessMessage(byte[] messageBytes, TaskCompletionSource<bool> taskCompletionSource)
{
var charset = CharsetDetector.DetectFromBytes(messageBytes).Detected?.EncodingName;
var message = string.Equals(charset, "utf-8", StringComparison.OrdinalIgnoreCase)
@@ -81,11 +82,12 @@ namespace Emby.Server.Implementations.WebSockets
{
try
{
- handler.ProcessMessage(info).ConfigureAwait(false);
+ handler.ProcessMessage(info, taskCompletionSource).ConfigureAwait(false);
}
catch (Exception ex)
{
- _logger.LogError(ex, "{0} failed processing WebSocket message {1}", handler.GetType().Name, info.MessageType ?? string.Empty);
+ _logger.LogError(ex, "{HandlerType} failed processing WebSocket message {MessageType}",
+ handler.GetType().Name, info.MessageType ?? string.Empty);
}
}));