1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-10-21 17:33:59 +00:00

poll payload again if framed object get flushed during same iteration

This commit is contained in:
Nikolay Kim 2019-02-18 21:41:38 -08:00
parent 842da939dc
commit c8713d045c

View file

@ -167,7 +167,7 @@ where
}
/// Flush stream
fn poll_flush(&mut self) -> Poll<(), DispatchError<S::Error>> {
fn poll_flush(&mut self) -> Poll<bool, DispatchError<S::Error>> {
if !self.framed.is_write_buf_empty() {
match self.framed.poll_complete() {
Ok(Async::NotReady) => Ok(Async::NotReady),
@ -180,11 +180,11 @@ where
if self.payload.is_some() && self.state.is_empty() {
return Err(DispatchError::PayloadIsNotConsumed);
}
Ok(Async::Ready(()))
Ok(Async::Ready(true))
}
}
} else {
Ok(Async::Ready(()))
Ok(Async::Ready(false))
}
}
@ -482,8 +482,12 @@ where
} else {
inner.poll_keepalive()?;
inner.poll_request()?;
inner.poll_response()?;
inner.poll_flush()?;
loop {
inner.poll_response()?;
if let Async::Ready(false) = inner.poll_flush()? {
break;
}
}
if inner.flags.contains(Flags::DISCONNECTED) {
return Ok(Async::Ready(H1ServiceResult::Disconnected));