Fix write behavior

This commit is contained in:
quininer 2019-09-26 00:24:32 +08:00
parent 41b25ec745
commit aa6e8444de
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,6 @@
[package] [package]
name = "tokio-rustls" name = "tokio-rustls"
version = "0.12.0-alpha.2" version = "0.12.0-alpha.3"
authors = ["quininer kel <quininer@live.com>"] authors = ["quininer kel <quininer@live.com>"]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
repository = "https://github.com/quininer/tokio-rustls" repository = "https://github.com/quininer/tokio-rustls"

View File

@ -110,6 +110,14 @@ impl<'a, IO: AsyncRead + AsyncWrite + Unpin, S: Session> Stream<'a, IO, S> {
} }
} }
if let Focus::Writable = focus {
if !write_would_block {
return Poll::Ready(Ok((rdlen, wrlen)));
} else {
return Poll::Pending;
}
}
if !self.eof && self.session.wants_read() { if !self.eof && self.session.wants_read() {
match self.complete_read_io(cx) { match self.complete_read_io(cx) {
Poll::Ready(Ok(0)) => self.eof = true, Poll::Ready(Ok(0)) => self.eof = true,