mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 02:35:31 +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
|
.info_hashes
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|(i, info_hash)| {
|
.map(|(i, info_hash)| {
|
||||||
let s = if let Some(torrent_data) = torrents.0.get(&info_hash) {
|
let stats = torrents
|
||||||
create_torrent_scrape_statistics(
|
.0
|
||||||
torrent_data.num_seeders as i32,
|
.get(&info_hash)
|
||||||
torrent_data.num_leechers as i32,
|
.map(|torrent_data| {
|
||||||
)
|
create_torrent_scrape_statistics(
|
||||||
} else {
|
torrent_data.num_seeders as i32,
|
||||||
EMPTY_STATS
|
torrent_data.num_leechers as i32,
|
||||||
};
|
)
|
||||||
|
})
|
||||||
|
.unwrap_or(EMPTY_STATS);
|
||||||
|
|
||||||
(i, s)
|
(i, stats)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue