diff --git a/Cargo.toml b/Cargo.toml index e8ea275..39a0675 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,7 @@ authors = ["quininer kel "] futures = "*" tokio-core = "*" rustls = "*" + +[dev-dependencies] +clap = "*" +webpki-roots = "*" diff --git a/src/lib.rs b/src/lib.rs index b51ae20..197e5cc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -161,11 +161,11 @@ impl io::Read for TlsStream where S: Io, C: Session { fn read(&mut self, buf: &mut [u8]) -> io::Result { - loop { - match self.session.read(buf) { - Ok(0) if !self.eof => self.do_io()?, - output => return output - } + self.do_io()?; + if self.eof { + Ok(0) + } else { + self.session.read(buf) } } }