mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 18:55:32 +00:00
udp: statistics: show number of peers
This commit is contained in:
parent
59e95894b9
commit
c78716153b
3 changed files with 23 additions and 1 deletions
|
|
@ -128,6 +128,14 @@ pub fn run_request_worker(
|
|||
if now > last_cleaning + cleaning_interval {
|
||||
torrents.clean(&config, &state.access_list);
|
||||
|
||||
if !statistics_update_interval.is_zero() {
|
||||
let peers_ipv4 = torrents.ipv4.values().map(|t| t.peers.len()).sum();
|
||||
let peers_ipv6 = torrents.ipv6.values().map(|t| t.peers.len()).sum();
|
||||
|
||||
state.statistics.peers_ipv4[worker_index.0].store(peers_ipv4, Ordering::SeqCst);
|
||||
state.statistics.peers_ipv6[worker_index.0].store(peers_ipv6, Ordering::SeqCst);
|
||||
}
|
||||
|
||||
last_cleaning = now;
|
||||
}
|
||||
if !statistics_update_interval.is_zero()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue