From d6d06041d9735ba64d09e845b184873e36056e41 Mon Sep 17 00:00:00 2001 From: PZ Read Date: Fri, 26 May 2017 17:59:51 +0800 Subject: [PATCH] Fix empty buffer --- src/lib.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 87f461f..2c6a7e9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -227,6 +227,10 @@ impl io::Write for TlsStream where S: AsyncRead + AsyncWrite, C: Session { fn write(&mut self, buf: &[u8]) -> io::Result { + if buf.len() == 0 { + return Ok(0); + } + loop { let output = self.session.write(buf)?;