From b9bc5a2aa48820828e48911a299580f95fb294d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sat, 27 Nov 2021 18:12:19 +0100 Subject: [PATCH] udp: request worker: use ValidUntil::new_with_now --- TODO.md | 1 - aquatic_udp/src/lib/workers/request.rs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index 10fc822..98be979 100644 --- a/TODO.md +++ b/TODO.md @@ -17,7 +17,6 @@ * cargo-deny * aquatic_udp - * request worker: use `ValidUntil::new_with_now` * look at proper cpu pinning (check that one thread gets bound per core) * then consider so_attach_reuseport_cbpf * what poll event capacity is actually needed? diff --git a/aquatic_udp/src/lib/workers/request.rs b/aquatic_udp/src/lib/workers/request.rs index 00d0d53..dd0498b 100644 --- a/aquatic_udp/src/lib/workers/request.rs +++ b/aquatic_udp/src/lib/workers/request.rs @@ -121,10 +121,10 @@ pub fn run_request_worker( } if iter_counter % 128 == 0 { - peer_valid_until = ValidUntil::new(config.cleaning.max_peer_age); - let now = Instant::now(); + peer_valid_until = ValidUntil::new_with_now(now, config.cleaning.max_peer_age); + if now > last_cleaning + cleaning_interval { torrents.clean(&config, &state.access_list);