File tree 2 files changed +28
-0
lines changed
2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -1268,6 +1268,17 @@ sockopt_impl!(
1268
1268
libc:: SO_EXCLBIND ,
1269
1269
bool
1270
1270
) ;
1271
+ #[ cfg( target_os = "linux" ) ]
1272
+ #[ cfg( feature = "net" ) ]
1273
+ sockopt_impl ! (
1274
+ #[ cfg_attr( docsrs, doc( cfg( feature = "net" ) ) ) ]
1275
+ /// Get tcp_info structure.
1276
+ TcpInfo ,
1277
+ GetOnly ,
1278
+ libc:: SOL_TCP ,
1279
+ libc:: TCP_INFO ,
1280
+ libc:: tcp_info
1281
+ ) ;
1271
1282
1272
1283
#[ allow( missing_docs) ]
1273
1284
// Not documented by Linux!
Original file line number Diff line number Diff line change @@ -568,6 +568,23 @@ fn test_ipv6_tclass() {
568
568
assert_eq ! ( getsockopt( & fd, sockopt:: Ipv6TClass ) . unwrap( ) , class) ;
569
569
}
570
570
571
+ #[ test]
572
+ #[ cfg( target_os = "linux" ) ]
573
+ fn test_tcp_info ( ) {
574
+ let fd = socket (
575
+ AddressFamily :: Inet6 ,
576
+ SockType :: Stream ,
577
+ SockFlag :: empty ( ) ,
578
+ SockProtocol :: Tcp ,
579
+ )
580
+ . unwrap ( ) ;
581
+ let tcp_info = getsockopt ( & fd, sockopt:: TcpInfo ) . unwrap ( ) ;
582
+ // Silly assert for the sake of having one in the test.
583
+ // There should be no retransmits because nothing is sent through the
584
+ // socket in the first place.
585
+ assert_eq ! ( tcp_info. tcpi_retransmits, 0 ) ;
586
+ }
587
+
571
588
#[ test]
572
589
#[ cfg( target_os = "freebsd" ) ]
573
590
fn test_receive_timestamp ( ) {
You can’t perform that action at this time.
0 commit comments