@@ -709,7 +709,7 @@ pub(crate) fn set_tcp_keepidle(fd: BorrowedFd<'_>, duration: Duration) -> io::Re
709709#[ inline]
710710pub ( crate ) fn get_tcp_keepidle ( fd : BorrowedFd < ' _ > ) -> io:: Result < Duration > {
711711 let secs: c:: c_uint = getsockopt ( fd, c:: IPPROTO_TCP , c:: TCP_KEEPIDLE ) ?;
712- Ok ( Duration :: from_secs ( secs as u64 ) )
712+ Ok ( Duration :: from_secs ( secs. into ( ) ) )
713713}
714714
715715#[ inline]
@@ -721,7 +721,7 @@ pub(crate) fn set_tcp_keepintvl(fd: BorrowedFd<'_>, duration: Duration) -> io::R
721721#[ inline]
722722pub ( crate ) fn get_tcp_keepintvl ( fd : BorrowedFd < ' _ > ) -> io:: Result < Duration > {
723723 let secs: c:: c_uint = getsockopt ( fd, c:: IPPROTO_TCP , c:: TCP_KEEPINTVL ) ?;
724- Ok ( Duration :: from_secs ( secs as u64 ) )
724+ Ok ( Duration :: from_secs ( secs. into ( ) ) )
725725}
726726
727727#[ inline]
@@ -755,9 +755,10 @@ pub(crate) fn set_tcp_congestion(fd: BorrowedFd<'_>, value: &str) -> io::Result<
755755#[ cfg( feature = "alloc" ) ]
756756#[ inline]
757757pub ( crate ) fn get_tcp_congestion ( fd : BorrowedFd < ' _ > ) -> io:: Result < String > {
758+ const OPTLEN : c:: socklen_t = 16 ;
759+
758760 let level = c:: IPPROTO_TCP ;
759761 let optname = c:: TCP_CONGESTION ;
760- const OPTLEN : c:: socklen_t = 16 ;
761762 let mut value = MaybeUninit :: < [ MaybeUninit < u8 > ; OPTLEN as usize ] > :: uninit ( ) ;
762763 let mut optlen = OPTLEN ;
763764 getsockopt_raw ( fd, level, optname, & mut value, & mut optlen) ?;
0 commit comments