From faeb8eb8f3a0cb8509da2ee980f0177a414a6354 Mon Sep 17 00:00:00 2001 From: John Smith Date: Mon, 19 Dec 2022 10:34:27 -0500 Subject: [PATCH] adjust routes --- .../routing_table/tasks/private_route_management.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/veilid-core/src/routing_table/tasks/private_route_management.rs b/veilid-core/src/routing_table/tasks/private_route_management.rs index c6686f67..2a1162b5 100644 --- a/veilid-core/src/routing_table/tasks/private_route_management.rs +++ b/veilid-core/src/routing_table/tasks/private_route_management.rs @@ -49,11 +49,17 @@ impl RoutingTable { if !stats.needs_testing(cur_ts) { return Option::<()>::None; } - if v.is_published() { + // If this has been published, always test if we need it + // Also if the route has never been tested, test it at least once + if v.is_published() || stats.last_tested_ts.is_none() { must_test_routes.push(*k); - } else if v.hop_count() == default_route_hop_count { + } + // If this is a default route hop length, include it in routes to keep alive + else if v.hop_count() == default_route_hop_count { unpublished_routes.push((*k, stats.latency_stats.average.as_u64())); - } else { + } + // Else this is a route that hasnt been used recently enough and we can tear it down + else { dead_routes.push(*k); } Option::<()>::None