From 3114d9e826e5aa1948d394a7d6d488f61ab1da97 Mon Sep 17 00:00:00 2001 From: kalcutter Date: Wed, 23 Sep 2020 16:21:18 +0200 Subject: [PATCH] net: change `UnixListener::poll_accept` to public (#2845) --- tokio/src/net/tcp/listener.rs | 6 +++--- tokio/src/net/unix/listener.rs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tokio/src/net/tcp/listener.rs b/tokio/src/net/tcp/listener.rs index 44945e387..0d7bbdbb1 100644 --- a/tokio/src/net/tcp/listener.rs +++ b/tokio/src/net/tcp/listener.rs @@ -185,10 +185,10 @@ impl TcpListener { poll_fn(|cx| self.poll_accept(cx)).await } - /// Attempts to poll `SocketAddr` and `TcpStream` bound to this address. + /// Polls to accept a new incoming connection to this listener. /// - /// In case if I/O resource isn't ready yet, `Poll::Pending` is returned and - /// current task will be notified by a waker. + /// If there is no connection to accept, `Poll::Pending` is returned and + /// the current task will be notified by a waker. pub fn poll_accept( &mut self, cx: &mut Context<'_>, diff --git a/tokio/src/net/unix/listener.rs b/tokio/src/net/unix/listener.rs index 119dc6fb4..fc3c8710a 100644 --- a/tokio/src/net/unix/listener.rs +++ b/tokio/src/net/unix/listener.rs @@ -104,7 +104,11 @@ impl UnixListener { poll_fn(|cx| self.poll_accept(cx)).await } - pub(crate) fn poll_accept( + /// Polls to accept a new incoming connection to this listener. + /// + /// If there is no connection to accept, `Poll::Pending` is returned and + /// the current task will be notified by a waker. + pub fn poll_accept( &mut self, cx: &mut Context<'_>, ) -> Poll> {