mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-01 10:15:31 +00:00
udp: remove socket_worker config, adjust other code, fix statistics
This commit is contained in:
parent
c4fd3c9e83
commit
71a3cb9a5a
4 changed files with 12 additions and 70 deletions
|
|
@ -25,7 +25,6 @@ pub struct StatisticsCollector {
|
|||
statistics: Statistics,
|
||||
ip_version: IpVersion,
|
||||
last_update: Instant,
|
||||
pending_histograms: Vec<Histogram<u64>>,
|
||||
last_complete_histogram: PeerHistogramStatistics,
|
||||
}
|
||||
|
||||
|
|
@ -34,19 +33,13 @@ impl StatisticsCollector {
|
|||
Self {
|
||||
statistics,
|
||||
last_update: Instant::now(),
|
||||
pending_histograms: Vec::new(),
|
||||
last_complete_histogram: Default::default(),
|
||||
ip_version,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn add_histogram(&mut self, config: &Config, histogram: Histogram<u64>) {
|
||||
self.pending_histograms.push(histogram);
|
||||
|
||||
if self.pending_histograms.len() == config.swarm_workers {
|
||||
self.last_complete_histogram =
|
||||
PeerHistogramStatistics::new(self.pending_histograms.drain(..).sum());
|
||||
}
|
||||
pub fn add_histogram(&mut self, histogram: Histogram<u64>) {
|
||||
self.last_complete_histogram = PeerHistogramStatistics::new(histogram);
|
||||
}
|
||||
|
||||
pub fn collect_from_shared(
|
||||
|
|
|
|||
|
|
@ -81,8 +81,8 @@ pub fn run_statistics_worker(
|
|||
|
||||
for message in statistics_receiver.try_iter() {
|
||||
match message {
|
||||
StatisticsMessage::Ipv4PeerHistogram(h) => ipv4_collector.add_histogram(&config, h),
|
||||
StatisticsMessage::Ipv6PeerHistogram(h) => ipv6_collector.add_histogram(&config, h),
|
||||
StatisticsMessage::Ipv4PeerHistogram(h) => ipv4_collector.add_histogram(h),
|
||||
StatisticsMessage::Ipv6PeerHistogram(h) => ipv6_collector.add_histogram(h),
|
||||
StatisticsMessage::PeerAdded(peer_id) => {
|
||||
if process_peer_client_data {
|
||||
peers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue