Skip to content

Commit

Permalink
Close #95: Account for link cost in route select
Browse files Browse the repository at this point in the history
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
  • Loading branch information
LeeSmet committed Jan 31, 2024
1 parent 34f158f commit 33251c4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,9 @@ impl Router {
// If we swap to an actually different route, only do so if the metric is
// significantly better OR if it is directly connected (metric 0).
if (best.source() != current.source() || best.neighbour() != current.neighbour())
&& !(best.metric() < current.metric() - SIGNIFICANT_METRIC_IMPROVEMENT
&& !(best.metric() + Metric::from(best.neighbour().link_cost())
< current.metric() + Metric::from(current.neighbour().link_cost())
- SIGNIFICANT_METRIC_IMPROVEMENT
|| best.metric().is_direct())
{
debug!("maintaining currently selected route since new route is not significantly better");
Expand Down

0 comments on commit 33251c4

Please sign in to comment.