From d6f8adcb538d1ad99f023e998d32add9a57d4d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Wed, 15 Mar 2023 23:29:59 +0100 Subject: [PATCH] udp: uring: reduce buffer sizes --- aquatic_udp/src/workers/socket/uring/mod.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/aquatic_udp/src/workers/socket/uring/mod.rs b/aquatic_udp/src/workers/socket/uring/mod.rs index e457b2e..283d0c3 100644 --- a/aquatic_udp/src/workers/socket/uring/mod.rs +++ b/aquatic_udp/src/workers/socket/uring/mod.rs @@ -34,8 +34,17 @@ use super::storage::PendingScrapeResponseSlab; use super::validator::ConnectionValidator; use super::{create_socket, EXTRA_PACKET_SIZE_IPV4, EXTRA_PACKET_SIZE_IPV6}; -const RESPONSE_BUF_LEN: usize = 8192; -const REQUEST_BUF_LEN: usize = 4096; +/// Size of each request buffer +/// +/// Enough for scrape request with 20 info hashes +const REQUEST_BUF_LEN: usize = 256; + +/// Size of each response buffer +/// +/// Enough for: +/// - IPv6 announce response with 112 peers +/// - scrape response for 170 info hashes +const RESPONSE_BUF_LEN: usize = 2048; const USER_DATA_RECV: u64 = u64::MAX; const USER_DATA_PULSE_TIMEOUT: u64 = u64::MAX - 1;