From 1baead993a625be2b5a607e2fdf8c9f251b8137e Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 29 Dec 2017 11:45:56 -0800 Subject: [PATCH] call poll_io recursevely aftre drain completion --- src/channel.rs | 3 +-- src/pipeline.rs | 17 ++++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/channel.rs b/src/channel.rs index 37bbe771b..633a05952 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -5,8 +5,7 @@ use bytes::Bytes; use futures::{Future, Poll, Async}; use tokio_io::{AsyncRead, AsyncWrite}; -use h1; -use h2; +use {h1, h2}; use error::Error; use h1writer::Writer; use httprequest::HttpRequest; diff --git a/src/pipeline.rs b/src/pipeline.rs index 473f2f9bd..e8d739428 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -711,8 +711,16 @@ impl ProcessResponse { // flush io but only if we need to if self.running == RunningState::Paused || self.drain.is_some() { match io.poll_completed() { - Ok(Async::Ready(_)) => - self.running.resume(), + Ok(Async::Ready(_)) => { + self.running.resume(); + + // resolve drain futures + if let Some(tx) = self.drain.take() { + let _ = tx.send(()); + } + // restart io processing + return self.poll_io(io, info); + }, Ok(Async::NotReady) => return Err(PipelineState::Response(self)), Err(err) => { @@ -723,11 +731,6 @@ impl ProcessResponse { } } - // drain futures - if let Some(tx) = self.drain.take() { - let _ = tx.send(()); - } - // response is completed match self.iostate { IOState::Done => {