Skip to content

Commit 08266ff

Browse files
committed
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
1 parent c6c4abf commit 08266ff

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

library/std/src/os/unix/net/listener.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,20 @@ impl UnixListener {
7575
let (addr, len) = sockaddr_un(path.as_ref())?;
7676
#[cfg(any(target_os = "windows", target_os = "redox", target_os = "espidf"))]
7777
const backlog: libc::c_int = 128;
78-
#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd"))]
78+
#[cfg(any(
79+
target_os = "linux",
80+
target_os = "freebsd",
81+
target_os = "openbsd",
82+
target_os = "macos"
83+
))]
7984
const backlog: libc::c_int = -1;
8085
#[cfg(not(any(
8186
target_os = "windows",
8287
target_os = "redox",
8388
target_os = "linux",
8489
target_os = "freebsd",
8590
target_os = "openbsd",
91+
target_os = "macos",
8692
target_os = "espidf"
8793
)))]
8894
const backlog: libc::c_int = libc::SOMAXCONN;

0 commit comments

Comments
 (0)