mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 10:12:51 +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);
|
await destination.CloseOutputAsync(WebSocketCloseStatus.EndpointUnavailable, null, cancellationToken);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
catch (WebSocketException e)
|
||||||
|
{
|
||||||
|
if (e.WebSocketErrorCode == WebSocketError.ConnectionClosedPrematurely)
|
||||||
|
{
|
||||||
|
await destination.CloseOutputAsync(WebSocketCloseStatus.EndpointUnavailable, null, cancellationToken);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
if (result.MessageType == WebSocketMessageType.Close)
|
if (result.MessageType == WebSocketMessageType.Close)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user