route work

This commit is contained in:
John Smith 2022-12-19 17:22:52 -05:00
parent ee30f19ecf
commit 64ae83bf82
2 changed files with 6 additions and 6 deletions

View File

@ -42,7 +42,7 @@ impl RoutingTable {
let rss = self.route_spec_store(); let rss = self.route_spec_store();
let mut must_test_routes = Vec::<DHTKey>::new(); let mut must_test_routes = Vec::<DHTKey>::new();
let mut unpublished_routes = Vec::<(DHTKey, u64)>::new(); let mut unpublished_routes = Vec::<(DHTKey, u64)>::new();
let mut dead_routes = Vec::<DHTKey>::new(); let mut expired_routes = Vec::<DHTKey>::new();
rss.list_allocated_routes(|k, v| { rss.list_allocated_routes(|k, v| {
let stats = v.get_stats(); let stats = v.get_stats();
// Ignore nodes that don't need testing // Ignore nodes that don't need testing
@ -60,7 +60,7 @@ impl RoutingTable {
} }
// Else this is a route that hasnt been used recently enough and we can tear it down // Else this is a route that hasnt been used recently enough and we can tear it down
else { else {
dead_routes.push(*k); expired_routes.push(*k);
} }
Option::<()>::None Option::<()>::None
}); });
@ -76,13 +76,13 @@ impl RoutingTable {
// Kill off all but N unpublished routes rather than testing them // Kill off all but N unpublished routes rather than testing them
if unpublished_routes.len() > BACKGROUND_SAFETY_ROUTE_COUNT { if unpublished_routes.len() > BACKGROUND_SAFETY_ROUTE_COUNT {
for x in &unpublished_routes[BACKGROUND_SAFETY_ROUTE_COUNT..] { for x in &unpublished_routes[BACKGROUND_SAFETY_ROUTE_COUNT..] {
dead_routes.push(x.0); expired_routes.push(x.0);
} }
} }
// Process dead routes // Process dead routes
for r in &dead_routes { for r in &expired_routes {
log_rtab!(debug "Dead route no test: {}", r); log_rtab!(debug "Expired route: {}", r);
rss.release_route(r); rss.release_route(r);
} }

View File

@ -121,7 +121,7 @@ where
Ok(res Ok(res
.on_timeout(|| { .on_timeout(|| {
log_rpc!(debug "op wait timed out: {}", handle.op_id); log_rpc!(debug "op wait timed out: {}", handle.op_id);
debug_print_backtrace(); // debug_print_backtrace();
self.cancel_op_waiter(handle.op_id); self.cancel_op_waiter(handle.op_id);
}) })
.map(|res| { .map(|res| {