mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-03-31 17:55:36 +00:00
udp: request workers: improve handle_scrape_request code
This commit is contained in:
parent
b8a74f0724
commit
80171170c8
1 changed files with 11 additions and 9 deletions
|
|
@ -193,16 +193,18 @@ fn handle_scrape_request<I: Ip>(
|
|||
.info_hashes
|
||||
.into_iter()
|
||||
.map(|(i, info_hash)| {
|
||||
let s = if let Some(torrent_data) = torrents.0.get(&info_hash) {
|
||||
create_torrent_scrape_statistics(
|
||||
torrent_data.num_seeders as i32,
|
||||
torrent_data.num_leechers as i32,
|
||||
)
|
||||
} else {
|
||||
EMPTY_STATS
|
||||
};
|
||||
let stats = torrents
|
||||
.0
|
||||
.get(&info_hash)
|
||||
.map(|torrent_data| {
|
||||
create_torrent_scrape_statistics(
|
||||
torrent_data.num_seeders as i32,
|
||||
torrent_data.num_leechers as i32,
|
||||
)
|
||||
})
|
||||
.unwrap_or(EMPTY_STATS);
|
||||
|
||||
(i, s)
|
||||
(i, stats)
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue