Skip to content

Commit

Permalink
fix(lib): fix no_proto dispatcher to flush queue before polling more …
Browse files Browse the repository at this point in the history
…body
  • Loading branch information
seanmonstar committed Nov 14, 2017
1 parent 3f62bde commit 121b5ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/proto/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion src/proto/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) => {
Expand All @@ -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);
}
Expand Down

0 comments on commit 121b5ee

Please sign in to comment.