Fix non-terminating loop in tokio_io::length_delimited::FramedWrite (#576)

* tokio-io: fix non-terminating loop in length_delimited::FramedWrite (#497)
This commit is contained in:
Eliza Weisman
2018-08-31 06:31:43 -04:00
committed by Toby Lawrence
parent a7b053372f
commit bc91bc5022
3 changed files with 26 additions and 1 deletions
+6 -1
View File
@@ -455,7 +455,12 @@ impl<T: AsyncWrite, B: IntoBuf> FramedWrite<T, B> {
loop {
let frame = self.frame.as_mut().unwrap();
try_ready!(self.inner.write_buf(frame));
if try_ready!(self.inner.write_buf(frame)) == 0 {
return Err(io::Error::new(
io::ErrorKind::WriteZero,
"failed to write frame to transport",
));
}
if !frame.has_remaining() {
break;