From 266d847839c71616bdc877462ea07b45ec946494 Mon Sep 17 00:00:00 2001 From: Maxim Kim Date: Wed, 10 Oct 2018 01:11:36 -0700 Subject: [PATCH] fix keep alive implementation --- src/DotNetty.Codecs.Http/HttpServerKeepAliveHandler.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/DotNetty.Codecs.Http/HttpServerKeepAliveHandler.cs b/src/DotNetty.Codecs.Http/HttpServerKeepAliveHandler.cs index cbec7c65c..aae9166bc 100644 --- a/src/DotNetty.Codecs.Http/HttpServerKeepAliveHandler.cs +++ b/src/DotNetty.Codecs.Http/HttpServerKeepAliveHandler.cs @@ -52,7 +52,9 @@ public override ValueTask WriteAsync(IChannelHandlerContext context, object mess } if (message is ILastHttpContent && !this.ShouldKeepAlive()) { - return new ValueTask(base.WriteAsync(context, message).CloseOnComplete(context)); + Task task = base.WriteAsync(context, message).AsTask(); + task.CloseOnComplete(context.Channel); + return new ValueTask(task); } return base.WriteAsync(context, message); }