diff options
author | Stuart Stock <stuart@int08h.com> | 2019-01-23 20:56:56 -0600 |
---|---|---|
committer | Stuart Stock <stuart@int08h.com> | 2019-01-23 20:56:56 -0600 |
commit | ea61800c269c542d0231b9129863e6a07b5869f6 (patch) | |
tree | e1d0497465be79b2e8e26006eac8ca2391580432 /src/stats | |
parent | ce425f96a3f0b4413325926c5d0209998e0aad45 (diff) | |
download | roughenough-ea61800c269c542d0231b9129863e6a07b5869f6.zip |
Enhanced client stats logging output
Diffstat (limited to 'src/stats')
-rw-r--r-- | src/stats/mod.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/stats/mod.rs b/src/stats/mod.rs index 126b88b..35fabdf 100644 --- a/src/stats/mod.rs +++ b/src/stats/mod.rs @@ -13,6 +13,8 @@ // limitations under the License. use hashbrown::HashMap; +use hashbrown::hash_map::Iter; + use std::net::IpAddr; /// Maximum number of stats entries to maintain. @@ -42,6 +44,8 @@ pub trait ClientStats { fn get_stats(&self, addr: &IpAddr) -> Option<&StatEntry>; + fn iter(&self) -> Iter<IpAddr, StatEntry>; + fn clear(&mut self); } @@ -196,11 +200,13 @@ impl ClientStats for SimpleStats { } fn get_stats(&self, addr: &IpAddr) -> Option<&StatEntry> { - self.clients.iter() - self.clients.get(addr) } + fn iter(&self) -> Iter<IpAddr, StatEntry> { + self.clients.iter() + } + fn clear(&mut self) { self.clients.clear(); self.num_overflows = 0; |