From 6d784c25e99e5f647c7aea273493abbf279428d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 10 Feb 2024 15:56:34 +0100 Subject: [PATCH] udp: remove pending scrape config stuff, adjust io uring code --- crates/udp/src/config.rs | 10 ---------- crates/udp/src/workers/socket/uring/mod.rs | 23 +--------------------- 2 files changed, 1 insertion(+), 32 deletions(-) diff --git a/crates/udp/src/config.rs b/crates/udp/src/config.rs index 8dfcfce..7532cf8 100644 --- a/crates/udp/src/config.rs +++ b/crates/udp/src/config.rs @@ -210,28 +210,18 @@ impl Default for StatisticsConfig { pub struct CleaningConfig { /// Clean torrents this often (seconds) pub torrent_cleaning_interval: u64, - /// Clean pending scrape responses this often (seconds) - /// - /// In regular operation, there should be no pending scrape responses - /// lingering for long enough to have to be cleaned up this way. - pub pending_scrape_cleaning_interval: u64, /// Allow clients to use a connection token for this long (seconds) pub max_connection_age: u32, /// Remove peers who have not announced for this long (seconds) pub max_peer_age: u32, - /// Remove pending scrape responses that have not been returned from swarm - /// workers for this long (seconds) - pub max_pending_scrape_age: u32, } impl Default for CleaningConfig { fn default() -> Self { Self { torrent_cleaning_interval: 60 * 2, - pending_scrape_cleaning_interval: 60 * 10, max_connection_age: 60 * 2, max_peer_age: 60 * 20, - max_pending_scrape_age: 60, } } } diff --git a/crates/udp/src/workers/socket/uring/mod.rs b/crates/udp/src/workers/socket/uring/mod.rs index 7ad26c7..fc3ab99 100644 --- a/crates/udp/src/workers/socket/uring/mod.rs +++ b/crates/udp/src/workers/socket/uring/mod.rs @@ -50,7 +50,6 @@ const RESPONSE_BUF_LEN: usize = 2048; const USER_DATA_RECV: u64 = u64::MAX; const USER_DATA_PULSE_TIMEOUT: u64 = u64::MAX - 1; -const USER_DATA_CLEANING_TIMEOUT: u64 = u64::MAX - 2; const SOCKET_IDENTIFIER: Fixed = Fixed(0); @@ -90,7 +89,6 @@ pub struct SocketWorker { resubmittable_sqe_buf: Vec, recv_sqe: io_uring::squeue::Entry, pulse_timeout_sqe: io_uring::squeue::Entry, - cleaning_timeout_sqe: io_uring::squeue::Entry, peer_valid_until: ValidUntil, rng: SmallRng, } @@ -147,21 +145,7 @@ impl SocketWorker { .user_data(USER_DATA_PULSE_TIMEOUT) }; - let cleaning_timeout_sqe = { - let timespec_ptr = Box::into_raw(Box::new( - Timespec::new().sec(config.cleaning.pending_scrape_cleaning_interval), - )) as *const _; - - Timeout::new(timespec_ptr) - .build() - .user_data(USER_DATA_CLEANING_TIMEOUT) - }; - - let resubmittable_sqe_buf = vec![ - recv_sqe.clone(), - pulse_timeout_sqe.clone(), - cleaning_timeout_sqe.clone(), - ]; + let resubmittable_sqe_buf = vec![recv_sqe.clone(), pulse_timeout_sqe.clone()]; let peer_valid_until = ValidUntil::new( shared_state.server_start_instant, @@ -181,7 +165,6 @@ impl SocketWorker { buf_ring, recv_sqe, pulse_timeout_sqe, - cleaning_timeout_sqe, resubmittable_sqe_buf, socket, peer_valid_until, @@ -263,10 +246,6 @@ impl SocketWorker { self.resubmittable_sqe_buf .push(self.pulse_timeout_sqe.clone()); } - USER_DATA_CLEANING_TIMEOUT => { - self.resubmittable_sqe_buf - .push(self.cleaning_timeout_sqe.clone()); - } send_buffer_index => { let result = cqe.result();