From 98491dd5a6ee83cc8487adcf39036a4991097553 Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Mon, 11 Jan 2021 07:24:41 +0800 Subject: [PATCH] revert Poll match in poll_flush --- actix-http/src/h1/dispatcher.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/actix-http/src/h1/dispatcher.rs b/actix-http/src/h1/dispatcher.rs index 0a25f3b22..feea7f34a 100644 --- a/actix-http/src/h1/dispatcher.rs +++ b/actix-http/src/h1/dispatcher.rs @@ -298,16 +298,13 @@ where let mut written = 0; while written < len { match io.as_mut().poll_write(cx, &write_buf[written..]) { - Poll::Ready(Ok(n)) => { - if n == 0 { - return Err(DispatchError::Io(io::Error::new( - io::ErrorKind::WriteZero, - "", - ))); - } else { - written += n; - } + Poll::Ready(Ok(0)) => { + return Err(DispatchError::Io(io::Error::new( + io::ErrorKind::WriteZero, + "", + ))) } + Poll::Ready(Ok(n)) => written += n, Poll::Pending => { write_buf.advance(written); return Ok(true);