From 82505a22030bf650f47469e8ff75125baa46c9aa Mon Sep 17 00:00:00 2001 From: Mike Birtwell Date: Wed, 13 Nov 2024 18:43:52 +0000 Subject: [PATCH] firmware: Disable the Nagle algorithm on sockets Signed-off-by: Michael Birtwell --- artiq/firmware/runtime/sched.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/artiq/firmware/runtime/sched.rs b/artiq/firmware/runtime/sched.rs index 0d751da8e..f0a2fdddd 100644 --- a/artiq/firmware/runtime/sched.rs +++ b/artiq/firmware/runtime/sched.rs @@ -402,16 +402,18 @@ impl<'a> TcpListener<'a> { socket.may_send() || socket.may_recv() })?; - let accepted = self.handle.get(); + let accepted = TcpStream { + io: self.io, + handle: self.handle.get(), + }; + accepted.with_lower(|s| s.set_nagle_enabled(false)); + self.handle.set(Self::new_lower(self.io, self.buffer_size.get())); match self.listen(self.endpoint.get()) { Ok(()) => (), _ => unreachable!() } - Ok(TcpStream { - io: self.io, - handle: accepted - }) + Ok(accepted) } pub fn close(&self) {