Fix empty buffer

This commit is contained in:
PZ Read 2017-05-26 17:59:51 +08:00
parent 185f010937
commit d6d06041d9

View File

@ -227,6 +227,10 @@ impl<S, C> io::Write for TlsStream<S, C>
where S: AsyncRead + AsyncWrite, C: Session where S: AsyncRead + AsyncWrite, C: Session
{ {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
if buf.len() == 0 {
return Ok(0);
}
loop { loop {
let output = self.session.write(buf)?; let output = self.session.write(buf)?;