Merge pull request #1000 from cvium/fix_object_disposed

Don't close the socket response multiple times
pull/1003/head
Vasily 6 years ago committed by GitHub
commit b3438559cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -164,33 +164,19 @@ namespace Jellyfin.Server.SocketSharp
Endpoint = endpoint
});
await ReceiveWebSocketAsync(ctx, socket).ConfigureAwait(false);
await socket.StartReceive().ConfigureAwait(false);
}
}
else
{
_logger.LogWarning("Web socket connection not allowed");
ctx.Response.StatusCode = 401;
ctx.Response.Close();
TryClose(ctx, 401);
}
}
catch (Exception ex)
{
_logger.LogError(ex, "AcceptWebSocketAsync error");
ctx.Response.StatusCode = 500;
ctx.Response.Close();
}
}
private async Task ReceiveWebSocketAsync(HttpListenerContext ctx, SharpWebSocket socket)
{
try
{
await socket.StartReceive().ConfigureAwait(false);
}
finally
{
TryClose(ctx, 200);
TryClose(ctx, 500);
}
}
@ -201,10 +187,6 @@ namespace Jellyfin.Server.SocketSharp
ctx.Response.StatusCode = statusCode;
ctx.Response.Close();
}
catch (ObjectDisposedException)
{
// TODO: Investigate and properly fix.
}
catch (Exception ex)
{
_logger.LogError(ex, "Error closing web socket response");

Loading…
Cancel
Save