Treat more exceptions from Socket.ReceiveAsync as aborted connections (#2122)

This commit is contained in:
Stephen Halter 2017-10-18 12:40:37 -07:00 committed by GitHub
parent 34c3233db9
commit c57aa3b2a8
1 changed files with 4 additions and 1 deletions

View File

@ -136,8 +136,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets
_trace.ConnectionReset(ConnectionId); _trace.ConnectionReset(ConnectionId);
} }
catch (SocketException ex) when (ex.SocketErrorCode == SocketError.OperationAborted || catch (SocketException ex) when (ex.SocketErrorCode == SocketError.OperationAborted ||
ex.SocketErrorCode == SocketError.Interrupted) ex.SocketErrorCode == SocketError.ConnectionAborted ||
ex.SocketErrorCode == SocketError.Interrupted ||
ex.SocketErrorCode == SocketError.InvalidArgument)
{ {
// Calling Dispose after ReceiveAsync can cause an "InvalidArgument" error on *nix.
error = new ConnectionAbortedException(); error = new ConnectionAbortedException();
_trace.ConnectionError(ConnectionId, error); _trace.ConnectionError(ConnectionId, error);
} }