From 17b3e4451fa9b28937cdc3719923042731c35369 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Wed, 21 Apr 2021 13:16:59 +0200 Subject: [PATCH] MaybeTlsStream: implement poll_write_vectored() This is just an performance optimization. --- src/tools/async_io.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/tools/async_io.rs b/src/tools/async_io.rs index 963f6fdd..83110912 100644 --- a/src/tools/async_io.rs +++ b/src/tools/async_io.rs @@ -60,6 +60,32 @@ impl AsyncWrite for MaybeTlsStream { } } + fn poll_write_vectored( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + bufs: &[io::IoSlice<'_>], + ) -> Poll> { + match self.get_mut() { + MaybeTlsStream::Normal(ref mut s) => { + Pin::new(s).poll_write_vectored(cx, bufs) + } + MaybeTlsStream::Proxied(ref mut s) => { + Pin::new(s).poll_write_vectored(cx, bufs) + } + MaybeTlsStream::Secured(ref mut s) => { + Pin::new(s).poll_write_vectored(cx, bufs) + } + } + } + + fn is_write_vectored(&self) -> bool { + match self { + MaybeTlsStream::Normal(s) => s.is_write_vectored(), + MaybeTlsStream::Proxied(s) => s.is_write_vectored(), + MaybeTlsStream::Secured(s) => s.is_write_vectored(), + } + } + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context) -> Poll> { match self.get_mut() { MaybeTlsStream::Normal(ref mut s) => {