aquatic_ws: move comment on empty info hashes to network.rs

This commit is contained in:
Joakim Frostegård 2021-11-01 19:25:14 +01:00
parent 786642f486
commit 23c2eff6f3
2 changed files with 2 additions and 2 deletions

View file

@ -282,8 +282,6 @@ pub fn handle_scrape_request(
&mut torrent_maps.ipv6 &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) { for info_hash in info_hashes.into_iter().take(num_to_take) {
if let Some(torrent_data) = torrent_map.get(&info_hash) { if let Some(torrent_data) = torrent_map.get(&info_hash) {
let stats = ScrapeStatistics { let stats = ScrapeStatistics {

View file

@ -305,6 +305,8 @@ impl Connection {
let info_hashes = if let Some(info_hashes) = info_hashes { let info_hashes = if let Some(info_hashes) = info_hashes {
info_hashes info_hashes
} else { } 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 { let out_message = OutMessage::ErrorResponse(ErrorResponse {
action: Some(ErrorResponseAction::Scrape), action: Some(ErrorResponseAction::Scrape),
failure_reason: "Full scrapes are not allowed".into(), failure_reason: "Full scrapes are not allowed".into(),