1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-28 09:42:40 +01: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 /// 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() { if !self.framed.is_write_buf_empty() {
match self.framed.poll_complete() { match self.framed.poll_complete() {
Ok(Async::NotReady) => Ok(Async::NotReady), Ok(Async::NotReady) => Ok(Async::NotReady),
@ -180,11 +180,11 @@ where
if self.payload.is_some() && self.state.is_empty() { if self.payload.is_some() && self.state.is_empty() {
return Err(DispatchError::PayloadIsNotConsumed); return Err(DispatchError::PayloadIsNotConsumed);
} }
Ok(Async::Ready(())) Ok(Async::Ready(true))
} }
} }
} else { } else {
Ok(Async::Ready(())) Ok(Async::Ready(false))
} }
} }
@ -482,8 +482,12 @@ where
} else { } else {
inner.poll_keepalive()?; inner.poll_keepalive()?;
inner.poll_request()?; inner.poll_request()?;
loop {
inner.poll_response()?; inner.poll_response()?;
inner.poll_flush()?; if let Async::Ready(false) = inner.poll_flush()? {
break;
}
}
if inner.flags.contains(Flags::DISCONNECTED) { if inner.flags.contains(Flags::DISCONNECTED) {
return Ok(Async::Ready(H1ServiceResult::Disconnected)); return Ok(Async::Ready(H1ServiceResult::Disconnected));