This should fix the country RTTs.

This commit is contained in:
Herbert Wolverson 2024-03-19 08:48:05 -05:00
parent e45bedc7ce
commit a2afa7fa9d
2 changed files with 11 additions and 21 deletions

View File

@ -62,7 +62,10 @@ impl TimeBuffer {
.map(|v| {
let (key, data, _analysis) = &v.data;
let (_name, country) = get_asn_name_and_country(key.remote_ip.as_ip());
let rtt = [0.0, 0.0];
let rtt = [
data.rtt[0].as_nanos() as f32,
data.rtt[1].as_nanos() as f32,
];
(country, data.bytes_sent, rtt)
})
.collect::<Vec<(String, [u64; 2], [f32; 2])>>();

View File

@ -233,28 +233,15 @@ impl ThroughputTracker {
if let Some(rtt) = rtt_samples.get(&key) {
// Add the RTT data to the per-circuit tracker
if let Some(tracker) = rtt_circuit_tracker.get_mut(&key.local_ip) {
tracker[0].push(rtt[0]);
tracker[1].push(rtt[1]);
} else {
if rtt[0].as_nanos() > 0 {
tracker[0].push(rtt[0]);
}
if rtt[1].as_nanos() > 0 {
tracker[1].push(rtt[1]);
}
} else if rtt[0].as_nanos() > 0 || rtt[1].as_nanos() > 0 {
rtt_circuit_tracker.insert(key.local_ip, [vec![rtt[0]], vec![rtt[1]]]);
}
/*for i in 0..2 {
if rtt[i].as_nanos() > 0 {
// Shift left
for i in 1..60 {
tracker.recent_rtt_data[i] = tracker.recent_rtt_data[i - 1];
}
tracker.recent_rtt_data[0] = rtt[i];
tracker.last_fresh_rtt_data_cycle = self_cycle;
if let Some(parents) = &tracker.network_json_parents {
let net_json = NETWORK_JSON.write().unwrap();
if let Some(rtt) = tracker.median_latency() {
net_json.add_rtt_cycle(parents, rtt);
}
}
}
}*/
}
if data.end_status != 0 {