From 7f69e889a409237ea72db561bda65dc34c296ec4 Mon Sep 17 00:00:00 2001 From: quininer Date: Sun, 8 Dec 2019 00:59:15 +0800 Subject: [PATCH] Fix incorrect prepare_uninitialized_buffer --- Cargo.toml | 1 + src/client.rs | 3 ++- src/server.rs | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e30cb12..e0822cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,6 +24,7 @@ webpki = "0.21" [features] early-data = [] dangerous_configuration = ["rustls/dangerous_configuration"] +unstable = [] [dev-dependencies] tokio = { version = "0.2.0", features = ["macros", "net", "io-util", "rt-core", "time"] } diff --git a/src/client.rs b/src/client.rs index 779ddc5..7807f12 100644 --- a/src/client.rs +++ b/src/client.rs @@ -69,8 +69,9 @@ impl AsyncRead for TlsStream where IO: AsyncRead + AsyncWrite + Unpin, { + #[cfg(feature = "unstable")] unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit]) -> bool { - self.io.prepare_uninitialized_buffer(buf) + false } fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll> { diff --git a/src/server.rs b/src/server.rs index 9066c27..0563341 100644 --- a/src/server.rs +++ b/src/server.rs @@ -67,8 +67,12 @@ impl AsyncRead for TlsStream where IO: AsyncRead + AsyncWrite + Unpin, { + #[cfg(feature = "unstable")] unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit]) -> bool { - self.io.prepare_uninitialized_buffer(buf) + // TODO + // + // https://doc.rust-lang.org/nightly/std/io/trait.Read.html#method.initializer + false } fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll> {