mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-05 21:37:10 -04:00
Merge pull request #1000 from cvium/fix_object_disposed
Don't close the socket response multiple times
This commit is contained in:
commit
b3438559cc
@ -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…
Reference in New Issue
Block a user