1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-30 18:34:36 +01: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 futures::{Future, Poll, Async};
use tokio_io::{AsyncRead, AsyncWrite}; use tokio_io::{AsyncRead, AsyncWrite};
use h1; use {h1, h2};
use h2;
use error::Error; use error::Error;
use h1writer::Writer; use h1writer::Writer;
use httprequest::HttpRequest; use httprequest::HttpRequest;

View File

@ -711,8 +711,16 @@ impl<S, H> ProcessResponse<S, H> {
// flush io but only if we need to // flush io but only if we need to
if self.running == RunningState::Paused || self.drain.is_some() { if self.running == RunningState::Paused || self.drain.is_some() {
match io.poll_completed() { match io.poll_completed() {
Ok(Async::Ready(_)) => Ok(Async::Ready(_)) => {
self.running.resume(), 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) => Ok(Async::NotReady) =>
return Err(PipelineState::Response(self)), return Err(PipelineState::Response(self)),
Err(err) => { 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 // response is completed
match self.iostate { match self.iostate {
IOState::Done => { IOState::Done => {