Only log connection error once
This commit is contained in:
parent
cd621509d0
commit
e5238ff383
|
|
@ -293,6 +293,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
private void CancellationTriggered()
|
||||
{
|
||||
lock (_contextLock)
|
||||
{
|
||||
if (!_cancelled)
|
||||
{
|
||||
// Abort the connection for any failed write
|
||||
// Queued on threadpool so get it in as first op.
|
||||
|
|
@ -300,6 +302,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
_cancelled = true;
|
||||
|
||||
CompleteAllWrites();
|
||||
|
||||
_log.ConnectionError(_connectionId, new TaskCanceledException("Write operation canceled. Aborting connection."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -434,17 +439,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Http
|
|||
private void CompleteAllWrites()
|
||||
{
|
||||
// Called inside _contextLock
|
||||
var writesToComplete = _tasksPending.Count > 0;
|
||||
var bytesLeftToBuffer = _maxBytesPreCompleted - _numBytesPreCompleted;
|
||||
while (_tasksPending.Count > 0)
|
||||
{
|
||||
CompleteNextWrite(ref bytesLeftToBuffer);
|
||||
}
|
||||
|
||||
if (writesToComplete)
|
||||
{
|
||||
_log.ConnectionError(_connectionId, new TaskCanceledException("Connetcion"));
|
||||
}
|
||||
}
|
||||
|
||||
// This is called on the libuv event loop
|
||||
|
|
|
|||
Loading…
Reference in New Issue