1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-29 00:07:48 +02:00

flush stream on drain

This commit is contained in:
Nikolay Kim
2018-01-11 16:22:27 -08:00
parent 0a41ecd01d
commit 0707dfe5bb
6 changed files with 91 additions and 9 deletions

View File

@@ -568,6 +568,16 @@ impl<S: 'static, H> ProcessResponse<S, H> {
if self.running == RunningState::Paused || self.drain.is_some() {
match io.poll_completed(false) {
Ok(Async::Ready(_)) => {
match io.flush() {
Ok(Async::Ready(_)) => (),
Ok(Async::NotReady) => return Err(PipelineState::Response(self)),
Err(err) => {
debug!("Error sending data: {}", err);
info.error = Some(err.into());
return Ok(FinishingMiddlewares::init(info, self.resp))
}
}
self.running.resume();
// resolve drain futures