diff options
| author | The rustc-josh-sync Cronjob Bot <github-actions@github.com> | 2025-09-29 04:07:50 +0000 | 
|---|---|---|
| committer | The rustc-josh-sync Cronjob Bot <github-actions@github.com> | 2025-09-29 04:07:50 +0000 | 
| commit | 24f6f94c5ad90be5d1ced24d83b8485712bcc27a (patch) | |
| tree | 722e3fdf88fdae0903cd1ff43cfc801db18345d3 /library/std/src/sys/net/connection/socket | |
| parent | 50171eb172a9418e8a20ad7d813d256305add5f0 (diff) | |
| parent | f957826bff7a68b267ce75b1ea56352aed0cca0a (diff) | |
| download | rust-24f6f94c5ad90be5d1ced24d83b8485712bcc27a.tar.gz rust-24f6f94c5ad90be5d1ced24d83b8485712bcc27a.zip | |
Merge ref 'f957826bff7a' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: f957826bff7a68b267ce75b1ea56352aed0cca0a Filtered ref: 7291893f9d875b6e8775a7a0e661abdaec15d3c1 Upstream diff: https://github.com/rust-lang/rust/compare/caccb4d0368bd918ef6668af8e13834d07040417...f957826bff7a68b267ce75b1ea56352aed0cca0a This merge was created using https://github.com/rust-lang/josh-sync.
Diffstat (limited to 'library/std/src/sys/net/connection/socket')
| -rw-r--r-- | library/std/src/sys/net/connection/socket/unix.rs | 9 | 
1 files changed, 5 insertions, 4 deletions
| diff --git a/library/std/src/sys/net/connection/socket/unix.rs b/library/std/src/sys/net/connection/socket/unix.rs index 8216f8d2fd5..a191576d93b 100644 --- a/library/std/src/sys/net/connection/socket/unix.rs +++ b/library/std/src/sys/net/connection/socket/unix.rs @@ -485,14 +485,15 @@ impl Socket { // bionic libc makes no use of this flag #[cfg(target_os = "linux")] - pub fn set_deferaccept(&self, accept: u32) -> io::Result<()> { - setsockopt(self, libc::IPPROTO_TCP, libc::TCP_DEFER_ACCEPT, accept as c_int) + pub fn set_deferaccept(&self, accept: Duration) -> io::Result<()> { + let val = cmp::min(accept.as_secs(), c_int::MAX as u64) as c_int; + setsockopt(self, libc::IPPROTO_TCP, libc::TCP_DEFER_ACCEPT, val) } #[cfg(target_os = "linux")] - pub fn deferaccept(&self) -> io::Result<u32> { + pub fn deferaccept(&self) -> io::Result<Duration> { let raw: c_int = getsockopt(self, libc::IPPROTO_TCP, libc::TCP_DEFER_ACCEPT)?; - Ok(raw as u32) + Ok(Duration::from_secs(raw as _)) } #[cfg(any(target_os = "freebsd", target_os = "netbsd"))] | 
