From 89ebde25a1c69ebcc995f02dd8feffb5a1738617 Mon Sep 17 00:00:00 2001 From: Cameron Bytheway Date: Tue, 3 Dec 2024 15:49:01 -0700 Subject: [PATCH] fix(s2n-quic-dc): set TCP_NODELAY on TCP sockets --- dc/s2n-quic-dc/src/stream/client/tokio.rs | 3 +++ dc/s2n-quic-dc/src/stream/server/tokio/tcp.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/dc/s2n-quic-dc/src/stream/client/tokio.rs b/dc/s2n-quic-dc/src/stream/client/tokio.rs index f3859aabf..7cfdc6e56 100644 --- a/dc/s2n-quic-dc/src/stream/client/tokio.rs +++ b/dc/s2n-quic-dc/src/stream/client/tokio.rs @@ -62,6 +62,9 @@ where // Race TCP handshake with the TLS handshake let (socket, peer) = tokio::try_join!(TcpStream::connect(acceptor_addr), handshake,)?; + // Make sure TCP_NODELAY is set + let _ = socket.set_nodelay(true); + let stream = endpoint::open_stream(env, peer, env::TcpRegistered(socket), subscriber, None)?; // build the stream inside the application context diff --git a/dc/s2n-quic-dc/src/stream/server/tokio/tcp.rs b/dc/s2n-quic-dc/src/stream/server/tokio/tcp.rs index b7c1b8a51..189b0afb0 100644 --- a/dc/s2n-quic-dc/src/stream/server/tokio/tcp.rs +++ b/dc/s2n-quic-dc/src/stream/server/tokio/tcp.rs @@ -501,6 +501,9 @@ where ) where Pub: EndpointPublisher, { + // Make sure TCP_NODELAY is set + let _ = stream.set_nodelay(true); + let meta = event::api::ConnectionMeta { id: 0, // TODO use an actual connection ID timestamp: now.into_event(),