about summary refs log tree commit diff
path: root/library/std/src/sys/unix
diff options
context:
space:
mode:
authorBerend-Jan Lange <berendjanlange@Berend-Jans-MBP.home>2022-04-22 21:39:09 +0200
committerberendjan <45036733+berendjan@users.noreply.github.com>2022-08-13 17:38:01 +0200
commit786e8755e7f8142c90a82351a11ad51acf5e1460 (patch)
tree5077c576fad816bcf728f818fe7fff4ed8b18449 /library/std/src/sys/unix
parent75b7e52e92c3b00fc891b47f5b2efdff0a2be55a (diff)
downloadrust-786e8755e7f8142c90a82351a11ad51acf5e1460.tar.gz
rust-786e8755e7f8142c90a82351a11ad51acf5e1460.zip
created tcpstream quickack trait
for linux and android
Diffstat (limited to 'library/std/src/sys/unix')
-rw-r--r--library/std/src/sys/unix/net.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/net.rs b/library/std/src/sys/unix/net.rs
index 462a45b01ab..85dcfc747af 100644
--- a/library/std/src/sys/unix/net.rs
+++ b/library/std/src/sys/unix/net.rs
@@ -393,6 +393,17 @@ impl Socket {
     }
 
     #[cfg(any(target_os = "android", target_os = "linux",))]
+    pub fn set_quickack(&self, quickack: bool) -> io::Result<()> {
+        setsockopt(self, libc::IPPROTO_TCP, libc::TCP_QUICKACK, quickack as c_int)
+    }
+
+    #[cfg(any(target_os = "android", target_os = "linux",))]
+    pub fn quickack(&self) -> io::Result<bool> {
+        let raw: c_int = getsockopt(self, libc::IPPROTO_TCP, libc::TCP_QUICKACK)?;
+        Ok(raw != 0)
+    }
+
+    #[cfg(any(target_os = "android", target_os = "linux",))]
     pub fn set_passcred(&self, passcred: bool) -> io::Result<()> {
         setsockopt(self, libc::SOL_SOCKET, libc::SO_PASSCRED, passcred as libc::c_int)
     }