1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
mod checkpoint;
mod command;
mod dht_periodic_lookup;
mod download_speed;
mod environment;
mod finalization;
mod hash_verification;
mod incoming;
mod peer_management;
mod peer_session;
mod pex;
mod piece_download;
mod registry;
mod state;
mod web_seed;
#[cfg(test)]
mod runtime_tests;
#[cfg(test)]
mod tests;
mod tracker_actor;
pub mod types;
mod upload_speed;
// Keep the download-execution interface at this module root for its callers.
pub(crate) use tracker_actor::BtTrackerAnnouncerActor;
pub use types::EndgameState;
pub(crate) use dht_periodic_lookup::{DhtPeriodicLookup, check_periodic_dht_lookup};
pub(crate) use download_speed::spawn as spawn_download_speed_reporter;
pub(crate) use pex::{PEX_SEND_INTERVAL, send_periodic_pex_to_swarm};
pub(crate) use upload_speed::spawn as spawn_upload_speed_reporter;
use std::collections::HashSet;
pub(crate) fn deduplicate_tracker_tiers(tiers: Vec<Vec<String>>) -> Vec<Vec<String>> {
let mut seen = HashSet::new();
tiers
.into_iter()
.filter_map(|tier| {
let unique = tier
.into_iter()
.filter(|url| seen.insert(url.clone()))
.collect::<Vec<_>>();
(!unique.is_empty()).then_some(unique)
})
.collect()
}