Skip to content

Commit 121b5ee

Browse files
committed
fix(lib): fix no_proto dispatcher to flush queue before polling more body
1 parent 3f62bde commit 121b5ee

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/proto/conn.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ where I: AsyncRead + AsyncWrite,
306306
}
307307
}
308308

309-
fn has_queued_body(&self) -> bool {
309+
pub fn has_queued_body(&self) -> bool {
310310
match self.state.writing {
311311
Writing::Body(_, Some(_)) => true,
312312
_ => false,

src/proto/dispatch.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ where
148148
self.conn.close_write();
149149
return Ok(Async::Ready(()));
150150
}
151+
} else if self.conn.has_queued_body() {
152+
try_ready!(self.poll_flush());
151153
} else if let Some(mut body) = self.body_rx.take() {
152154
let chunk = match body.poll()? {
153155
Async::Ready(Some(chunk)) => {
@@ -165,7 +167,7 @@ where
165167
return Ok(Async::NotReady);
166168
}
167169
};
168-
self.conn.write_body(Some(chunk))?;
170+
assert!(self.conn.write_body(Some(chunk))?.is_ready());
169171
} else {
170172
return Ok(Async::NotReady);
171173
}

0 commit comments

Comments
 (0)