From 3f65a271d4a4fee472d42062e75fda2cffdef130 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Thu, 1 Apr 2021 18:11:17 -0700 Subject: [PATCH] Reuse HttpProtocol CTS --- src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs index 2f575865930b..7b6c3b025789 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs @@ -400,8 +400,11 @@ public void Reset() lock (_abortLock) { _preventRequestAbortedCancellation = false; - localAbortCts = _abortedCts; - _abortedCts = null; + if (_abortedCts?.TryReset() == false) + { + localAbortCts = _abortedCts; + _abortedCts = null; + } } localAbortCts?.Dispose();