-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add ability to specify backlog size for TcpListener
and UnixListener
#94406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
…=joshtriplett Add `with_backlog` functionality to `TcpListener` and `UnixListener` Adds * `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` Closes rust-lang#94406
I have talked with @joshtriplett about the stuff that blocked my last attempt at a PR, and am going to try again in the next couple of weeks. Sorry for leaving this sitting for so long. |
Any updates on this? |
I am sad to report that there is not. I really feel bad, but there it is. The fundamental problem is that So I got stuck and never really got back to it. You can take a look at the patch linked above for how far I got. I can try to have some more discussion with folks and find a student for this. |
Closing as a duplicate of #55614, I don't think we need two issues for this. |
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 nightlystd::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
The text was updated successfully, but these errors were encountered: