Skip to content

Commit d8efd5a

Browse files
committed
iOS/tvOS/watchOS/visionOS: Default to kernel-defined backlog in listen
This behavior is defined in general for the XNU kernel, not just macOS: https://github.com/apple-oss-distributions/xnu/blob/rel/xnu-10002/bsd/kern/uipc_socket.c
1 parent 1704687 commit d8efd5a

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

+8-4
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,25 @@ impl UnixListener {
8181
))]
8282
const backlog: core::ffi::c_int = 128;
8383
#[cfg(any(
84+
// Silently capped to `/proc/sys/net/core/somaxconn`.
8485
target_os = "linux",
86+
// Silently capped to `kern.ipc.soacceptqueue`.
8587
target_os = "freebsd",
88+
// Silently capped to `kern.somaxconn sysctl`.
8689
target_os = "openbsd",
87-
target_os = "macos"
90+
// Silently capped to the default 128.
91+
target_vendor = "apple",
8892
))]
8993
const backlog: core::ffi::c_int = -1;
9094
#[cfg(not(any(
9195
target_os = "windows",
9296
target_os = "redox",
97+
target_os = "espidf",
98+
target_os = "horizon",
9399
target_os = "linux",
94100
target_os = "freebsd",
95101
target_os = "openbsd",
96-
target_os = "macos",
97-
target_os = "espidf",
98-
target_os = "horizon"
102+
target_vendor = "apple",
99103
)))]
100104
const backlog: libc::c_int = libc::SOMAXCONN;
101105

0 commit comments

Comments
 (0)