Update tokio to 0.3

pull/63/head
Constantin Nickel 4 years ago committed by Sebastian Dröge
parent cf9ca1ffae
commit 42fb96666b
  1. 10
      Cargo.toml
  2. 18
      src/tokio.rs

@ -42,7 +42,7 @@ version = "1.0"
[dependencies.real-tokio-openssl] [dependencies.real-tokio-openssl]
optional = true optional = true
version = "0.4" version = "0.5"
package = "tokio-openssl" package = "tokio-openssl"
[dependencies.openssl] [dependencies.openssl]
@ -66,17 +66,17 @@ package = "native-tls"
[dependencies.tokio] [dependencies.tokio]
optional = true optional = true
version = "0.2" version = "0.3"
features = ["tcp", "dns"] features = ["net"]
[dependencies.real-tokio-native-tls] [dependencies.real-tokio-native-tls]
optional = true optional = true
version = "0.1" version = "0.2"
package = "tokio-native-tls" package = "tokio-native-tls"
[dependencies.real-tokio-rustls] [dependencies.real-tokio-rustls]
optional = true optional = true
version = "^0.14" version = "^0.20"
package = "tokio-rustls" package = "tokio-rustls"
[dependencies.webpki-roots] [dependencies.webpki-roots]

@ -395,7 +395,11 @@ impl<T: tokio::io::AsyncRead> AsyncRead for TokioAdapter<T> {
cx: &mut Context<'_>, cx: &mut Context<'_>,
buf: &mut [u8], buf: &mut [u8],
) -> Poll<std::io::Result<usize>> { ) -> Poll<std::io::Result<usize>> {
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<T: AsyncRead> tokio::io::AsyncRead for TokioAdapter<T> {
fn poll_read( fn poll_read(
self: Pin<&mut Self>, self: Pin<&mut Self>,
cx: &mut Context<'_>, cx: &mut Context<'_>,
buf: &mut [u8], buf: &mut tokio::io::ReadBuf<'_>,
) -> Poll<std::io::Result<usize>> { ) -> Poll<std::io::Result<()>> {
self.project().0.poll_read(cx, buf) 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(()))
} }
} }

Loading…
Cancel
Save