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 => {