Skip to content

Commit

Permalink
std::net: bind update for using backlog as -1 too.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
devnexen committed Jan 15, 2024
1 parent 9567c3e commit 89cf177
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion library/std/src/os/unix/net/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,20 @@ impl 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",
target_os = "redox",
target_os = "linux",
target_os = "freebsd",
target_os = "openbsd",
target_os = "macos",
target_os = "espidf",
target_os = "horizon"
)))]
Expand Down

0 comments on commit 89cf177

Please sign in to comment.