mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 18:25:30 +00:00
udp: split statistics by ipv4/ipv6
This commit is contained in:
parent
34f263f6b9
commit
f68bbff700
4 changed files with 100 additions and 74 deletions
|
|
@ -232,10 +232,8 @@ pub struct Statistics {
|
|||
pub responses_sent: AtomicUsize,
|
||||
pub bytes_received: AtomicUsize,
|
||||
pub bytes_sent: AtomicUsize,
|
||||
pub torrents_ipv4: Vec<AtomicUsize>,
|
||||
pub torrents_ipv6: Vec<AtomicUsize>,
|
||||
pub peers_ipv4: Vec<AtomicUsize>,
|
||||
pub peers_ipv6: Vec<AtomicUsize>,
|
||||
pub torrents: Vec<AtomicUsize>,
|
||||
pub peers: Vec<AtomicUsize>,
|
||||
}
|
||||
|
||||
impl Statistics {
|
||||
|
|
@ -245,10 +243,8 @@ impl Statistics {
|
|||
responses_sent: Default::default(),
|
||||
bytes_received: Default::default(),
|
||||
bytes_sent: Default::default(),
|
||||
torrents_ipv4: Self::create_atomic_usize_vec(num_request_workers),
|
||||
torrents_ipv6: Self::create_atomic_usize_vec(num_request_workers),
|
||||
peers_ipv4: Self::create_atomic_usize_vec(num_request_workers),
|
||||
peers_ipv6: Self::create_atomic_usize_vec(num_request_workers),
|
||||
torrents: Self::create_atomic_usize_vec(num_request_workers),
|
||||
peers: Self::create_atomic_usize_vec(num_request_workers),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -262,14 +258,16 @@ impl Statistics {
|
|||
#[derive(Clone)]
|
||||
pub struct State {
|
||||
pub access_list: Arc<AccessListArcSwap>,
|
||||
pub statistics: Arc<Statistics>,
|
||||
pub statistics_ipv4: Arc<Statistics>,
|
||||
pub statistics_ipv6: Arc<Statistics>,
|
||||
}
|
||||
|
||||
impl State {
|
||||
pub fn new(num_request_workers: usize) -> Self {
|
||||
Self {
|
||||
access_list: Arc::new(AccessListArcSwap::default()),
|
||||
statistics: Arc::new(Statistics::new(num_request_workers)),
|
||||
statistics_ipv4: Arc::new(Statistics::new(num_request_workers)),
|
||||
statistics_ipv6: Arc::new(Statistics::new(num_request_workers)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue