diff options
| author | David CARLIER <devnexen@gmail.com> | 2022-08-21 06:58:51 +0100 |
|---|---|---|
| committer | David Carlier <devnexen@gmail.com> | 2022-08-22 16:27:37 +0100 |
| commit | 15c8e55601515583cf169e0371f62867e5719f47 (patch) | |
| tree | 023a1e6d63733c56e56bc6b5c9e826e04bf32029 | |
| parent | f2858b5cd32f3689ad83de77cacfa1ea2f533793 (diff) | |
| download | rust-15c8e55601515583cf169e0371f62867e5719f47.tar.gz rust-15c8e55601515583cf169e0371f62867e5719f47.zip | |
net listen backlog update, follow-up from #97963.
FreeBSD and using system limit instead for others.
| -rw-r--r-- | library/std/src/os/unix/net/listener.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/library/std/src/os/unix/net/listener.rs b/library/std/src/os/unix/net/listener.rs index 3b2601e755a..02090afc82f 100644 --- a/library/std/src/os/unix/net/listener.rs +++ b/library/std/src/os/unix/net/listener.rs @@ -73,10 +73,8 @@ impl UnixListener { unsafe { let inner = Socket::new_raw(libc::AF_UNIX, libc::SOCK_STREAM)?; let (addr, len) = sockaddr_un(path.as_ref())?; - #[cfg(target_os = "linux")] - const backlog: libc::c_int = -1; - #[cfg(not(target_os = "linux"))] - const backlog: libc::c_int = 128; + const backlog: libc::c_int = + if cfg!(any(target_os = "linux", target_os = "freebsd")) { -1 } else { 128 }; cvt(libc::bind(inner.as_inner().as_raw_fd(), &addr as *const _ as *const _, len as _))?; cvt(libc::listen(inner.as_inner().as_raw_fd(), backlog))?; |
