From ce328923873dc3d7bb0dcbfb620ddde09cdf9f2f Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Fri, 5 Jun 2020 13:39:44 +1200 Subject: [PATCH] Remove allocations by changing AsTask to GetAsTask (#22557) --- .../Kestrel/Core/src/Internal/Http2/Http2Connection.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs index fc97e00068..6c31c51827 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2Connection.cs @@ -22,6 +22,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2.FlowControl; using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; using Microsoft.Extensions.Logging; +using Microsoft.AspNetCore.Internal; namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 { @@ -752,7 +753,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 // the new size. _frameWriter.UpdateMaxHeaderTableSize(Math.Min(_clientSettings.HeaderTableSize, (uint)Limits.Http2.HeaderTableSize)); - return ackTask.AsTask(); + return ackTask.GetAsTask(); } catch (Http2SettingsParameterOutOfRangeException ex) { @@ -785,7 +786,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 return Task.CompletedTask; } - return _frameWriter.WritePingAsync(Http2PingFrameFlags.ACK, payload).AsTask(); + return _frameWriter.WritePingAsync(Http2PingFrameFlags.ACK, payload).GetAsTask(); } private Task ProcessGoAwayFrameAsync()