[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 = "*"
tokio-core = "*"
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
{
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
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)
}
}
}