Skip to content

Commit b1a4194

Browse files
Rollup merge of rust-lang#119026 - devnexen:listener_upd, r=Mark-Simulacrum
std::net::bind using -1 for openbsd which in turn sets it to somaxconn. trusting platform's SOMAXCONN instead of hardcoding to 128 otherwise.
2 parents 57ad505 + f5c3967 commit b1a4194

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ impl UnixListener {
7474
let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?;
7575
let (addr, len) = sockaddr_un(path.as_ref())?;
7676
const backlog: libc::c_int =
77-
if cfg!(any(target_os = "linux", target_os = "freebsd")) { -1 } else { 128 };
77+
if cfg!(any(target_os = "linux", target_os = "freebsd", target_os = "openbsd")) {
78+
-1
79+
} else {
80+
libc::SOMAXCONN
81+
};
7882

7983
cvt(libc::bind(inner.as_inner().as_raw_fd(), &addr as *const _ as *const _, len as _))?;
8084
cvt(libc::listen(inner.as_inner().as_raw_fd(), backlog))?;

0 commit comments

Comments
 (0)