Skip to content

Commit

Permalink
unpublished listener DEFAULT_BACKLOGs
Browse files Browse the repository at this point in the history
  • Loading branch information
BartMassey committed Feb 26, 2022
1 parent 8643947 commit b98c009
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
13 changes: 4 additions & 9 deletions library/std/src/net/tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,20 +707,16 @@ impl fmt::Debug for TcpStream {
}

impl TcpListener {
/// Default "backlog" for [`TcpListener::bind`]. See
/// [`TcpListener::bind_with_backlog`] for an explanation of backlog
/// values.
#[unstable(feature = "bind_with_backlog", issue = "94406")]
pub const DEFAULT_BACKLOG: usize = 128;
/// Default listen backlog.
const DEFAULT_BACKLOG: usize = 128;

/// Creates a new `TcpListener` which will be bound to the specified
/// address.
///
/// The given backlog specifies the maximum number of outstanding
/// connections that will be buffered in the OS waiting to be accepted by
/// [`TcpListener::accept`]. The backlog argument overrides the default
/// specified by [`TcpListener::DEFAULT_BACKLOG`]; that default is
/// reasonable for most use cases.
/// value of 128; that default is reasonable for most use cases.
///
/// This function is otherwise [`TcpListener::bind`]: see that
/// documentation for full details of operation.
Expand Down Expand Up @@ -751,8 +747,7 @@ impl TcpListener {
/// address. The returned listener is ready for accepting
/// connections.
///
/// The listener will have a backlog given by
/// [`TcpListener::DEFAULT_BACKLOG`]. See the documentation for
/// The listener will have a backlog of 128. See the documentation for
/// [`TcpListener::bind_with_backlog`] for further information.
///
/// Binding with a port number of 0 will request that the OS assigns a port
Expand Down
28 changes: 13 additions & 15 deletions library/std/src/os/unix/net/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,12 @@ impl fmt::Debug for UnixListener {
}

impl UnixListener {
/// Default "backlog" for [`UnixListener::bind`] and
/// [`UnixListener::bind_addr`]. See [`UnixListener::bind_with_backlog`]
/// for an explanation of backlog values.
#[unstable(feature = "bind_with_backlog", issue = "94406")]
pub const DEFAULT_BACKLOG: usize = 128;
/// Default backlog for `bind` and `bind_addr`.
const DEFAULT_BACKLOG: usize = 128;

/// Creates a new `UnixListener` bound to the specified socket.
///
/// The listener will have a backlog given by
/// [`UnixListener::DEFAULT_BACKLOG`]. See the documentation for
/// The listener will have a backlog of 128. See the documentation for
/// [`UnixListener::bind_with_backlog`] for further information.
///
/// # Examples
Expand All @@ -87,10 +83,10 @@ impl UnixListener {
/// Creates a new `UnixListener` bound to the specified socket.
///
/// The given backlog specifies the maximum number of outstanding
/// connections that will be buffered in the OS waiting to be accepted by
/// [`UnixListener::accept`]. The backlog argument overrides the default
/// specified by [`UnixListener::DEFAULT_BACKLOG`]; that default is
/// reasonable for most use cases.
/// connections that will be buffered in the OS waiting to be accepted
/// by [`UnixListener::accept`]. The backlog argument overrides the
/// default backlog of 128; that default is reasonable for most use
/// cases.
///
/// This function is otherwise [`UnixListener::bind`]: see that
/// documentation for full details of operation.
Expand Down Expand Up @@ -133,6 +129,9 @@ impl UnixListener {

/// Creates a new `UnixListener` bound to the specified [`socket address`].
///
/// The listener will have a backlog of 128. See the documentation for
/// [`UnixListener::bind_addr_with_backlog`] for further information.
///
/// [`socket address`]: crate::os::unix::net::SocketAddr
///
/// # Examples
Expand Down Expand Up @@ -163,10 +162,9 @@ impl UnixListener {
/// Creates a new `UnixListener` bound to the specified [`socket address`].
///
/// The given backlog specifies the maximum number of outstanding
/// connections that will be buffered in the OS waiting to be accepted by
/// [`UnixListener::accept`]. The backlog argument overrides the default
/// specified by [`UnixListener::DEFAULT_BACKLOG`]; that default is
/// reasonable for most use cases.
/// connections that will be buffered in the OS waiting to be accepted
/// by [`UnixListener::accept`]. The backlog argument overrides the
/// default of 128; that default is reasonable for most use cases.
///
/// This function is otherwise [`UnixListener::bind_addr`]: see that
/// documentation for full details of operation.
Expand Down

0 comments on commit b98c009

Please sign in to comment.