feat(server): add poll_peek to AddrStream (#2127)

This commit is contained in:
daxpedda
2020-02-17 20:31:36 +01:00
committed by GitHub
parent dd02254ae8
commit 24d53d3f66

View File

@@ -223,6 +223,17 @@ mod addr_stream {
pub fn into_inner(self) -> TcpStream { pub fn into_inner(self) -> TcpStream {
self.inner 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<io::Result<usize>> {
self.inner.poll_peek(cx, buf)
}
} }
impl AsyncRead for AddrStream { impl AsyncRead for AddrStream {