[Fixed] TlsStream::read ConnectionAborted
This commit is contained in:
parent
66835b5040
commit
6e7d67cccb
@ -7,3 +7,7 @@ authors = ["quininer kel <quininer@live.com>"]
|
||||
futures = "*"
|
||||
tokio-core = "*"
|
||||
rustls = "*"
|
||||
|
||||
[dev-dependencies]
|
||||
clap = "*"
|
||||
webpki-roots = "*"
|
||||
|
10
src/lib.rs
10
src/lib.rs
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user