mirror of
https://github.com/jmcorgan/fips.git
synced 2026-08-09 08:14:42 +00:00
Add flap dampening to parent selection
Track parent switch frequency in a sliding window. When switches exceed a configurable threshold (default 4 in 60s), impose an extended hold-down period (default 120s) that prevents non-mandatory parent changes. Mandatory switches (parent loss, root change, shouldn't-be-root) bypass dampening. The flap counter resets when the window expires naturally. Implements TASK-2026-0030 / IDEA-0013.
This commit is contained in:
@@ -374,6 +374,11 @@ impl Node {
|
||||
let mut tree_state = TreeState::new(node_addr);
|
||||
tree_state.set_parent_hysteresis(config.node.tree.parent_hysteresis);
|
||||
tree_state.set_hold_down(config.node.tree.hold_down_secs);
|
||||
tree_state.set_flap_dampening(
|
||||
config.node.tree.flap_threshold,
|
||||
config.node.tree.flap_window_secs,
|
||||
config.node.tree.flap_dampening_secs,
|
||||
);
|
||||
tree_state
|
||||
.sign_declaration(&identity)
|
||||
.expect("signing own declaration should never fail");
|
||||
@@ -459,6 +464,11 @@ impl Node {
|
||||
let mut tree_state = TreeState::new(node_addr);
|
||||
tree_state.set_parent_hysteresis(config.node.tree.parent_hysteresis);
|
||||
tree_state.set_hold_down(config.node.tree.hold_down_secs);
|
||||
tree_state.set_flap_dampening(
|
||||
config.node.tree.flap_threshold,
|
||||
config.node.tree.flap_window_secs,
|
||||
config.node.tree.flap_dampening_secs,
|
||||
);
|
||||
tree_state
|
||||
.sign_declaration(&identity)
|
||||
.expect("signing own declaration should never fail");
|
||||
|
||||
Reference in New Issue
Block a user