From 24d53d3f66f843a6c19204cc7c52cd80e327d41a Mon Sep 17 00:00:00 2001 From: daxpedda Date: Mon, 17 Feb 2020 20:31:36 +0100 Subject: [PATCH] feat(server): add `poll_peek` to `AddrStream` (#2127) --- src/server/tcp.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/server/tcp.rs b/src/server/tcp.rs index 2046d441fd..b823818693 100644 --- a/src/server/tcp.rs +++ b/src/server/tcp.rs @@ -223,6 +223,17 @@ mod addr_stream { pub fn into_inner(self) -> TcpStream { self.inner } + + /// Attempt to receive data on the socket, without removing that data + /// from the queue, registering the current task for wakeup if data is + /// not yet available. + pub fn poll_peek( + &mut self, + cx: &mut task::Context<'_>, + buf: &mut [u8], + ) -> Poll> { + self.inner.poll_peek(cx, buf) + } } impl AsyncRead for AddrStream {