移除过期统计值

This commit is contained in:
lbl
2026-03-02 15:52:24 +08:00
parent 39602c478e
commit e088d305b1
3 changed files with 37 additions and 14 deletions
+12
View File
@@ -259,6 +259,18 @@ impl PacketLossStats {
}
}
pub fn remove(&self, ip: &Ipv4Addr, route_key: &RouteKey) {
let mut write = self.inner.write();
write.remove(&(*ip, *route_key));
}
pub fn remove_batch(&self, keys: &[(Ipv4Addr, RouteKey)]) {
let mut write = self.inner.write();
for key in keys {
write.remove(key);
}
}
pub fn reset_all(&self) {
let read = self.inner.read();
for stats in read.values() {