Further decouple SystemInterval values.

This commit is contained in:
Roman S. Borschel
2020-09-14 11:19:43 +02:00
parent 227e35bb64
commit d8ae36dc34
2 changed files with 22 additions and 13 deletions
+16 -6
View File
@@ -142,12 +142,22 @@ impl Node {
}
pub fn update_stats(&mut self, interval: &SystemInterval) -> Option<&NodeStats> {
if self.stats != interval.stats {
self.stats = interval.stats;
Some(&self.stats)
} else {
None
}
let mut changed = false;
if let Some(peers) = interval.peers {
self.stats.peers = peers;
changed = true;
}
if let Some(txcount) = interval.txcount {
self.stats.txcount = txcount;
changed = true;
}
if changed {
Some(&self.stats)
} else {
None
}
}
pub fn update_io(&mut self, interval: &SystemInterval) -> Option<&NodeIO> {