1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-12-23 08:36:34 +00:00

call poll_io recursevely aftre drain completion

This commit is contained in:
Nikolay Kim 2017-12-29 11:45:56 -08:00
parent 3d3e4dae9a
commit 1baead993a
2 changed files with 11 additions and 9 deletions

View file

@ -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;

View file

@ -711,8 +711,16 @@ impl<S, H> ProcessResponse<S, H> {
// 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<S, H> ProcessResponse<S, H> {
}
}
// drain futures
if let Some(tx) = self.drain.take() {
let _ = tx.send(());
}
// response is completed
match self.iostate {
IOState::Done => {