Close connection gracefully in Frame.ProduceEnd
- Try sending a FIN before closing the socket - Don't attempt to send a FIN twice for the same connection
This commit is contained in:
parent
513abb4561
commit
7b315d2470
|
|
@ -449,7 +449,7 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
if (_responseStarted)
|
if (_responseStarted)
|
||||||
{
|
{
|
||||||
// We can no longer respond with a 500, so we simply close the connection.
|
// We can no longer respond with a 500, so we simply close the connection.
|
||||||
ConnectionControl.End(ProduceEndType.SocketDisconnect);
|
_keepAlive = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -475,7 +475,10 @@ namespace Microsoft.AspNet.Server.Kestrel.Http
|
||||||
WriteChunkedResponseSuffix();
|
WriteChunkedResponseSuffix();
|
||||||
}
|
}
|
||||||
|
|
||||||
ConnectionControl.End(_keepAlive ? ProduceEndType.ConnectionKeepAlive : ProduceEndType.SocketShutdownSend);
|
if (_keepAlive)
|
||||||
|
{
|
||||||
|
ConnectionControl.End(ProduceEndType.ConnectionKeepAlive);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Tuple<ArraySegment<byte>, IDisposable> CreateResponseHeader(
|
private Tuple<ArraySegment<byte>, IDisposable> CreateResponseHeader(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue