Skip to content

Add ability to specify backlog size for TcpListener and UnixListener #94406

Closed as not planned
@BartMassey

Description

@BartMassey

In socket-style network interfaces, the server side typically requests a "backlog" from the operating system. This controls how many requests the OS is willing to buffer before failing or ignoring new requests.

The backlogs used by std::net::TcpListener::bind, std::os::unix::net::UnixListener::bind and the nightly std::os::unix::net::UnixListener::bind_addr are currently hardwired to 128. This is a reasonable default, but there are situations where one might want to set a larger or smaller number. Also, that 128 default should probably be a publicly-exposed constant.

To address these issues I have posted a PR that provides the following new APIs:

  • std::net::TcpListener::DEFAULT_BACKLOG
  • std::net::TcpListener::bind_with_backlog
  • std::os::unix::net::UnixListener::DEFAULT_BACKLOG
  • std::os::unix::net::UnixListener::bind_with_backlog
  • std::os::unix::net::UnixListener::bind_addr_with_backlog

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ioArea: `std::io`, `std::fs`, `std::net` and `std::path`T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions