From aa6e8444def3b4aa62099583459fbdf73e4f2e38 Mon Sep 17 00:00:00 2001 From: quininer Date: Thu, 26 Sep 2019 00:24:32 +0800 Subject: [PATCH] Fix write behavior --- Cargo.toml | 2 +- src/common/mod.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a4c0e67..63b4122 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tokio-rustls" -version = "0.12.0-alpha.2" +version = "0.12.0-alpha.3" authors = ["quininer kel "] license = "MIT/Apache-2.0" repository = "https://github.com/quininer/tokio-rustls" diff --git a/src/common/mod.rs b/src/common/mod.rs index ac72608..1af5ecb 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -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() { match self.complete_read_io(cx) { Poll::Ready(Ok(0)) => self.eof = true,