Files
RedBear-OS/local/patches/relibc/P3-tcp-nodelay.patch
T

41 lines
1.5 KiB
Diff

diff --git a/src/header/sys_socket/constants.rs b/src/header/sys_socket/constants.rs
index ec42889b..c91ffb1a 100644
--- a/src/header/sys_socket/constants.rs
+++ b/src/header/sys_socket/constants.rs
@@ -75,3 +75,6 @@ pub const SHUT_WR: c_int = 1;
pub const SCM_RIGHTS: c_int = 1;
pub const SCM_CREDENTIALS: c_int = 2;
+
+pub const IPPROTO_TCP: c_int = 6;
+pub const TCP_NODELAY: c_int = 1;
diff --git a/src/platform/redox/socket.rs b/src/platform/redox/socket.rs
index d223c36f..5e17a2e5 100644
--- a/src/platform/redox/socket.rs
+++ b/src/platform/redox/socket.rs
@@ -1063,6 +1063,24 @@ impl PalSocket for Sys {
return Ok(());
}
},
+ crate::header::sys_socket::constants::IPPROTO_TCP => {
+ match option_name {
+ crate::header::sys_socket::constants::TCP_NODELAY => {
+ let metadata = [SocketCall::SetSockOpt as u64, option_name as u64];
+ let payload = unsafe {
+ slice::from_raw_parts_mut(option_value as *mut u8, option_len as usize)
+ };
+ redox_rt::sys::sys_call_rw(
+ socket as usize,
+ payload,
+ CallFlags::empty(),
+ &metadata,
+ )?;
+ return Ok(());
+ }
+ _ => (),
+ }
+ }
_ => (),
}