Skip to content
This repository has been archived by the owner on Jun 25, 2021. It is now read-only.

Commit

Permalink
fix: fixing stress statistic couting error
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi authored and dirvine committed May 13, 2021
1 parent 618d5a9 commit 47f2024
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions examples/stress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ impl Network {
elders,
self_status_change,
..
}
| RoutingEvent::SectionSplit {
elders,
self_status_change,
..
} => {
if let Some(Node::Joined {
name,
Expand All @@ -311,14 +316,15 @@ impl Network {
..
}) = self.nodes.get_mut(&id)
{
let old_prefix = *prefix;
*prefix = elders.prefix;

if elders.added.contains(name) {
if elders.added.contains(name) || elders.remaining.contains(name) {
*elder = Some(ElderState {
key: elders.key,
num_elders: elders.remaining.len() + elders.added.len(),
});
} else {
} else if elders.removed.contains(name) && old_prefix == elders.prefix {
*elder = None;
}
}
Expand Down

0 comments on commit 47f2024

Please sign in to comment.