mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
std::net: bind update for using backlog as -1 too.
Albeit not documented, macOs also support negative value for the backlog argument. ref: https://github.com/apple/darwin-xnu/blob/2ff845c2e033bd0ff64b5b6aa6063a1f8f65aa32/bsd/kern/uipc_socket.c#L1061
This commit is contained in:
@@ -80,7 +80,12 @@ pub fn bind<P: AsRef<Path>>(path: P) -> io::Result<UnixListener> {
|
||||
target_os = "horizon"
|
||||
))]
|
||||
const backlog: libc::c_int = 128;
|
||||
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
|
||||
#[cfg(any(
|
||||
target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "macos"
|
||||
))]
|
||||
const backlog: libc::c_int = -1;
|
||||
#[cfg(not(any(
|
||||
target_os = "windows",
|
||||
@@ -88,6 +93,7 @@ pub fn bind<P: AsRef<Path>>(path: P) -> io::Result<UnixListener> {
|
||||
target_os = "linux",
|
||||
target_os = "freebsd",
|
||||
target_os = "openbsd",
|
||||
target_os = "macos",
|
||||
target_os = "espidf",
|
||||
target_os = "horizon"
|
||||
)))]
|
||||
|
||||
Reference in New Issue
Block a user