From e228f5a4c28f97551105bccd7481eb59218451ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Sun, 3 Apr 2022 01:44:29 +0200 Subject: [PATCH] http_private: make TorrentMap cleaning logic more readable --- aquatic_http_private/src/workers/request.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/aquatic_http_private/src/workers/request.rs b/aquatic_http_private/src/workers/request.rs index 4698d4d..be09c0d 100644 --- a/aquatic_http_private/src/workers/request.rs +++ b/aquatic_http_private/src/workers/request.rs @@ -107,9 +107,9 @@ impl TorrentMaps { let num_leechers = &mut torrent_data.num_leechers; torrent_data.peers.retain(|_, peer| { - let keep = peer.valid_until.0 >= now; - - if !keep { + if peer.valid_until.0 >= now { + true + } else { match peer.status { PeerStatus::Seeding => { *num_seeders -= 1; @@ -119,9 +119,9 @@ impl TorrentMaps { } _ => (), }; - } - keep + false + } }); !torrent_data.peers.is_empty()