@@ -1334,6 +1334,57 @@ impl crate::Socket {
13341334 }
13351335 }
13361336
1337+ /// Get the value of the `TCP_QUICKACK` option on this socket.
1338+ ///
1339+ /// For more information about this option, see [`set_quickack`].
1340+ ///
1341+ /// [`set_quickack`]: Socket::set_quickack
1342+ #[ cfg( all(
1343+ feature = "all" ,
1344+ any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" )
1345+ ) ) ]
1346+ #[ cfg_attr(
1347+ docsrs,
1348+ doc( cfg( all(
1349+ feature = "all" ,
1350+ any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" )
1351+ ) ) )
1352+ ) ]
1353+ pub fn quickack ( & self ) -> io:: Result < bool > {
1354+ unsafe {
1355+ getsockopt :: < Bool > ( self . as_raw ( ) , libc:: IPPROTO_TCP , libc:: TCP_QUICKACK )
1356+ . map ( |quickack| quickack != 0 )
1357+ }
1358+ }
1359+
1360+ /// Set the value of the `TCP_QUICKACK` option on this socket.
1361+ ///
1362+ /// If set, acks are sent immediately, rather than delayed if needed in accordance to normal
1363+ /// TCP operation. This flag is not permanent, it only enables a switch to or from quickack mode.
1364+ /// Subsequent operation of the TCP protocol will once again enter/leave quickack mode depending on
1365+ /// internal protocol processing and factors such as delayed ack timeouts occurring and data transfer.
1366+ #[ cfg( all(
1367+ feature = "all" ,
1368+ any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" )
1369+ ) ) ]
1370+ #[ cfg_attr(
1371+ docsrs,
1372+ doc( cfg( all(
1373+ feature = "all" ,
1374+ any( target_os = "android" , target_os = "fuchsia" , target_os = "linux" )
1375+ ) ) )
1376+ ) ]
1377+ pub fn set_quickack ( & self , quickack : bool ) -> io:: Result < ( ) > {
1378+ unsafe {
1379+ setsockopt (
1380+ self . as_raw ( ) ,
1381+ libc:: IPPROTO_TCP ,
1382+ libc:: TCP_QUICKACK ,
1383+ quickack as c_int ,
1384+ )
1385+ }
1386+ }
1387+
13371388 /// Gets the value for the `SO_BINDTODEVICE` option on this socket.
13381389 ///
13391390 /// This value gets the socket binded device's interface name.
0 commit comments