Skip to content

Commit

Permalink
fix(http): keep flushing until WOULDBLOCK is received
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmonstar committed Jan 24, 2017
1 parent 529ad56 commit cfcbd8c
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/http/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,13 @@ impl<T: Write> Write for Buffered<T> {
if self.write_buf.remaining() == 0 {
Ok(())
} else {
self.write_buf.write_into(&mut self.io).and_then(|n| {
loop {
let n = try!(self.write_buf.write_into(&mut self.io));
debug!("flushed {} bytes", n);
if self.write_buf.remaining() == 0 {
Ok(())
} else {
Err(io::Error::new(io::ErrorKind::WouldBlock, "wouldblock"))
return Ok(())
}
})
}
}
}
}
Expand Down Expand Up @@ -295,7 +294,6 @@ impl WriteBuf {
trace!("WriteBuf reserving initial {}", init);
vec.reserve(init);
} else if cap < MAX_BUFFER_SIZE {
trace!("maybe_reserve MAX={}, needed={}, cap={}", MAX_BUFFER_SIZE, needed, cap);
vec.reserve(cmp::min(needed, MAX_BUFFER_SIZE - cap));
trace!("WriteBuf reserved {}", vec.capacity() - cap);
}
Expand Down

0 comments on commit cfcbd8c

Please sign in to comment.