Skip to content

Commit

Permalink
feat(server): add poll_peek to AddrStream (#2127)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Feb 17, 2020
1 parent dd02254 commit 24d53d3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/server/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<io::Result<usize>> {
self.inner.poll_peek(cx, buf)
}
}

impl AsyncRead for AddrStream {
Expand Down

0 comments on commit 24d53d3

Please sign in to comment.