From 675d3aefd3f569bf4be1c839b1d1ddc58581c7e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Sat, 28 May 2022 18:38:28 +0200 Subject: [PATCH] add some conservative recv and send buffer size, to handle slow acks --- network/src/channel.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/network/src/channel.rs b/network/src/channel.rs index 51a294bbee..97fe17b315 100644 --- a/network/src/channel.rs +++ b/network/src/channel.rs @@ -101,6 +101,13 @@ impl Protocols { socket2_socket.set_only_v6(true)? } socket2_socket.set_nonblocking(true)?; // Needed by Tokio + // Increase Buffers size to 256 KiB and 128 KiB + if let Err(e) = socket2_socket.set_send_buffer_size(256 * 1024) { + trace!(?e, "couldn't specify send buffer size"); + } + if let Err(e) = socket2_socket.set_recv_buffer_size(128 * 1024) { + trace!(?e, "couldn't specify recv buffer size"); + } // See https://docs.rs/tokio/latest/tokio/net/struct.TcpSocket.html #[cfg(not(windows))] socket2_socket.set_reuse_address(true)?;