From 23c2eff6f3a7634068594f28dbcdfbfcd9c84e17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Frosteg=C3=A5rd?= Date: Mon, 1 Nov 2021 19:25:14 +0100 Subject: [PATCH] aquatic_ws: move comment on empty info hashes to network.rs --- aquatic_ws/src/lib/handlers.rs | 2 -- aquatic_ws/src/lib/network.rs | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aquatic_ws/src/lib/handlers.rs b/aquatic_ws/src/lib/handlers.rs index b7bd88f..bfb337d 100644 --- a/aquatic_ws/src/lib/handlers.rs +++ b/aquatic_ws/src/lib/handlers.rs @@ -282,8 +282,6 @@ pub fn handle_scrape_request( &mut torrent_maps.ipv6 }; - // If request.info_hashes is empty, don't return scrape for all - // torrents, even though reference server does it. It is too expensive. for info_hash in info_hashes.into_iter().take(num_to_take) { if let Some(torrent_data) = torrent_map.get(&info_hash) { let stats = ScrapeStatistics { diff --git a/aquatic_ws/src/lib/network.rs b/aquatic_ws/src/lib/network.rs index 6d64740..f800222 100644 --- a/aquatic_ws/src/lib/network.rs +++ b/aquatic_ws/src/lib/network.rs @@ -305,6 +305,8 @@ impl Connection { let info_hashes = if let Some(info_hashes) = info_hashes { info_hashes } else { + // If request.info_hashes is empty, don't return scrape for all + // torrents, even though reference server does it. It is too expensive. let out_message = OutMessage::ErrorResponse(ErrorResponse { action: Some(ErrorResponseAction::Scrape), failure_reason: "Full scrapes are not allowed".into(),