fix(lib): fix no_proto dispatcher to flush queue before polling more body

This commit is contained in:
Sean McArthur
2017-11-14 14:56:13 -08:00
parent 3f62bde7b3
commit 121b5eef19
2 changed files with 4 additions and 2 deletions

View File

@@ -306,7 +306,7 @@ where I: AsyncRead + AsyncWrite,
}
}
fn has_queued_body(&self) -> bool {
pub fn has_queued_body(&self) -> bool {
match self.state.writing {
Writing::Body(_, Some(_)) => true,
_ => false,

View File

@@ -148,6 +148,8 @@ where
self.conn.close_write();
return Ok(Async::Ready(()));
}
} else if self.conn.has_queued_body() {
try_ready!(self.poll_flush());
} else if let Some(mut body) = self.body_rx.take() {
let chunk = match body.poll()? {
Async::Ready(Some(chunk)) => {
@@ -165,7 +167,7 @@ where
return Ok(Async::NotReady);
}
};
self.conn.write_body(Some(chunk))?;
assert!(self.conn.write_body(Some(chunk))?.is_ready());
} else {
return Ok(Async::NotReady);
}