Fix incorrect prepare_uninitialized_buffer

This commit is contained in:
quininer 2019-12-08 00:59:15 +08:00
parent 074fe4a5ac
commit 7f69e889a4
3 changed files with 8 additions and 2 deletions

View File

@ -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"] }

View File

@ -69,8 +69,9 @@ impl<IO> AsyncRead for TlsStream<IO>
where
IO: AsyncRead + AsyncWrite + Unpin,
{
#[cfg(feature = "unstable")]
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit<u8>]) -> bool {
self.io.prepare_uninitialized_buffer(buf)
false
}
fn poll_read(self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &mut [u8]) -> Poll<io::Result<usize>> {

View File

@ -67,8 +67,12 @@ impl<IO> AsyncRead for TlsStream<IO>
where
IO: AsyncRead + AsyncWrite + Unpin,
{
#[cfg(feature = "unstable")]
unsafe fn prepare_uninitialized_buffer(&self, buf: &mut [std::mem::MaybeUninit<u8>]) -> 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<io::Result<usize>> {