From dcad9724bc1a056417818f89359476889438074c Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Wed, 10 Feb 2021 02:11:53 -0800 Subject: [PATCH] ensure poll_flush on h1 connection disconnect (#1974) --- actix-http/src/h1/dispatcher.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/actix-http/src/h1/dispatcher.rs b/actix-http/src/h1/dispatcher.rs index 8fbf3ede0..1d28a0a39 100644 --- a/actix-http/src/h1/dispatcher.rs +++ b/actix-http/src/h1/dispatcher.rs @@ -841,9 +841,8 @@ where if inner.flags.contains(Flags::WRITE_DISCONNECT) { Poll::Ready(Ok(())) } else { - // flush buffer - inner.as_mut().poll_flush(cx)?; - if !inner.write_buf.is_empty() { + // flush buffer and wait on block. + if inner.as_mut().poll_flush(cx)? { Poll::Pending } else { Pin::new(inner.project().io.as_mut().unwrap())