diff --git a/Cargo.toml b/Cargo.toml index ca38e44..537dd57 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,7 +42,7 @@ version = "1.0" [dependencies.real-tokio-openssl] optional = true -version = "0.4" +version = "0.5" package = "tokio-openssl" [dependencies.openssl] @@ -66,17 +66,17 @@ package = "native-tls" [dependencies.tokio] optional = true -version = "0.2" -features = ["tcp", "dns"] +version = "0.3" +features = ["net"] [dependencies.real-tokio-native-tls] optional = true -version = "0.1" +version = "0.2" package = "tokio-native-tls" [dependencies.real-tokio-rustls] optional = true -version = "^0.14" +version = "^0.20" package = "tokio-rustls" [dependencies.webpki-roots] diff --git a/src/tokio.rs b/src/tokio.rs index 8410aeb..bab4700 100644 --- a/src/tokio.rs +++ b/src/tokio.rs @@ -395,7 +395,11 @@ impl AsyncRead for TokioAdapter { cx: &mut Context<'_>, buf: &mut [u8], ) -> Poll> { - self.project().0.poll_read(cx, buf) + let mut buf = tokio::io::ReadBuf::new(buf); + match self.project().0.poll_read(cx, &mut buf)? { + Poll::Pending => Poll::Pending, + Poll::Ready(_) => Poll::Ready(Ok(buf.filled().len())), + } } } @@ -421,9 +425,15 @@ impl tokio::io::AsyncRead for TokioAdapter { fn poll_read( self: Pin<&mut Self>, cx: &mut Context<'_>, - buf: &mut [u8], - ) -> Poll> { - self.project().0.poll_read(cx, buf) + buf: &mut tokio::io::ReadBuf<'_>, + ) -> Poll> { + let slice = buf.initialize_unfilled(); + let n = match self.project().0.poll_read(cx, slice)? { + Poll::Pending => return Poll::Pending, + Poll::Ready(n) => n, + }; + buf.advance(n); + Poll::Ready(Ok(())) } }