File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed
sys/net/connection/socket Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ pub trait TcpStreamExt: Sealed {
60
60
61
61
/// A socket listener will be awakened solely when data arrives.
62
62
///
63
- /// The `accept` argument set the delay in seconds until the
63
+ /// The `accept` argument set the maximum delay until the
64
64
/// data is available to read, reducing the number of short lived
65
65
/// connections without data to process.
66
66
/// Contrary to other platforms `SO_ACCEPTFILTER` feature equivalent, there is
@@ -86,7 +86,7 @@ pub trait TcpStreamExt: Sealed {
86
86
#[ cfg( target_os = "linux" ) ]
87
87
fn set_deferaccept ( & self , accept : Duration ) -> io:: Result < ( ) > ;
88
88
89
- /// Gets the accept delay value (in seconds) of the `TCP_DEFER_ACCEPT` option.
89
+ /// Gets the accept delay value of the `TCP_DEFER_ACCEPT` option.
90
90
///
91
91
/// For more information about this option, see [`TcpStreamExt::set_deferaccept`].
92
92
///
Original file line number Diff line number Diff line change @@ -486,9 +486,7 @@ impl Socket {
486
486
// bionic libc makes no use of this flag
487
487
#[ cfg( target_os = "linux" ) ]
488
488
pub fn set_deferaccept ( & self , accept : Duration ) -> io:: Result < ( ) > {
489
- let Ok ( val) = c_int:: try_from ( accept. as_secs ( ) ) else {
490
- return Err ( io:: const_error!( io:: ErrorKind :: InvalidInput , "awakening time overflow" ) ) ;
491
- } ;
489
+ let val = cmp:: min ( accept. as_secs ( ) , c_int:: MAX as u64 ) as c_int ;
492
490
setsockopt ( self , libc:: IPPROTO_TCP , libc:: TCP_DEFER_ACCEPT , val)
493
491
}
494
492
You can’t perform that action at this time.
0 commit comments