mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-23 00:32:50 +08:00
Modified WebSocketMiddleWare to close connection on premature close (#998)
This commit is contained in:
parent
0ac77f2e50
commit
b6f3f0f28a
@ -47,6 +47,15 @@ namespace Ocelot.WebSockets.Middleware
|
||||
await destination.CloseOutputAsync(WebSocketCloseStatus.EndpointUnavailable, null, cancellationToken);
|
||||
return;
|
||||
}
|
||||
catch (WebSocketException e)
|
||||
{
|
||||
if (e.WebSocketErrorCode == WebSocketError.ConnectionClosedPrematurely)
|
||||
{
|
||||
await destination.CloseOutputAsync(WebSocketCloseStatus.EndpointUnavailable, null, cancellationToken);
|
||||
return;
|
||||
}
|
||||
throw;
|
||||
}
|
||||
|
||||
if (result.MessageType == WebSocketMessageType.Close)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user