[Fixed] TlsStream::read ConnectionAborted

This commit is contained in:
quininer kel 2017-02-21 19:08:23 +08:00
parent 66835b5040
commit 6e7d67cccb
2 changed files with 9 additions and 5 deletions

View File

@ -7,3 +7,7 @@ authors = ["quininer kel <quininer@live.com>"]
futures = "*" futures = "*"
tokio-core = "*" tokio-core = "*"
rustls = "*" rustls = "*"
[dev-dependencies]
clap = "*"
webpki-roots = "*"

View File

@ -161,11 +161,11 @@ impl<S, C> io::Read for TlsStream<S, C>
where S: Io, C: Session where S: Io, C: Session
{ {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
loop { self.do_io()?;
match self.session.read(buf) { if self.eof {
Ok(0) if !self.eof => self.do_io()?, Ok(0)
output => return output } else {
} self.session.read(buf)
} }
} }
} }