From fcb38fae6cb3d57ec406e83827b2a65558543bb3 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 8 Feb 2021 03:22:38 +0100 Subject: [PATCH] runtime: disable TCP delayed ack --- src/runtime/src/comms.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/runtime/src/comms.rs b/src/runtime/src/comms.rs index bfb4b4aa..da9d8ac5 100644 --- a/src/runtime/src/comms.rs +++ b/src/runtime/src/comms.rs @@ -313,7 +313,9 @@ async fn load_kernel(buffer: &Vec, control: &Rc>, s } } -async fn handle_connection(stream: &TcpStream, control: Rc>) -> Result<()> { +async fn handle_connection(stream: &mut TcpStream, control: Rc>) -> Result<()> { + stream.set_ack_delay(None); + if !expect(stream, b"ARTIQ coredev\n").await? { return Err(Error::UnexpectedPattern); } @@ -407,7 +409,7 @@ pub fn main(timer: GlobalTimer, cfg: Config) { let connection = Rc::new(Semaphore::new(1, 1)); let terminate = Rc::new(Semaphore::new(0, 1)); loop { - let stream = TcpStream::accept(1381, 0x10_000, 0x10_000).await.unwrap(); + let mut stream = TcpStream::accept(1381, 0x10_000, 0x10_000).await.unwrap(); if connection.try_wait().is_none() { // there is an existing connection @@ -425,7 +427,7 @@ pub fn main(timer: GlobalTimer, cfg: Config) { task::spawn(async move { select_biased! { _ = (async { - let _ = handle_connection(&stream, control.clone()) + let _ = handle_connection(&mut stream, control.clone()) .await .map_err(|e| warn!("connection terminated: {}", e)); if let Some(buffer) = &*idle_kernel {