From 88466db03fd69aa59128dd916298ceae2c4179f7 Mon Sep 17 00:00:00 2001 From: John Smith Date: Fri, 9 Jun 2023 22:42:03 -0400 Subject: [PATCH] better statusq failure recording --- veilid-core/src/routing_table/bucket_entry.rs | 2 +- veilid-core/src/rpc_processor/rpc_status.rs | 31 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/veilid-core/src/routing_table/bucket_entry.rs b/veilid-core/src/routing_table/bucket_entry.rs index 46206d0c..f133f4e5 100644 --- a/veilid-core/src/routing_table/bucket_entry.rs +++ b/veilid-core/src/routing_table/bucket_entry.rs @@ -603,7 +603,7 @@ impl BucketEntryInner { } } pub(super) fn check_dead(&self, cur_ts: Timestamp) -> bool { - // If we have failured to send NEVER_REACHED_PING_COUNT times in a row, the node is dead + // If we have failed to send NEVER_REACHED_PING_COUNT times in a row, the node is dead if self.peer_stats.rpc_stats.failed_to_send >= NEVER_REACHED_PING_COUNT { return true; } diff --git a/veilid-core/src/rpc_processor/rpc_status.rs b/veilid-core/src/rpc_processor/rpc_status.rs index f45ea125..179508ce 100644 --- a/veilid-core/src/rpc_processor/rpc_status.rs +++ b/veilid-core/src/rpc_processor/rpc_status.rs @@ -30,9 +30,19 @@ impl RPCProcessor { let routing_domain = match target.best_routing_domain() { Some(rd) => rd, None => { + // Because this exits before calling 'question()', + // a failure to find a routing domain constitutes a send failure + let send_ts = get_aligned_timestamp(); + self.record_send_failure( + RPCKind::Question, + send_ts, + target.clone(), + None, + None, + ); return Ok(NetworkResult::no_connection_other( "no routing domain for target", - )) + )); } }; (Some(target.clone()), routing_domain) @@ -45,9 +55,26 @@ impl RPCProcessor { let routing_domain = match relay.best_routing_domain() { Some(rd) => rd, None => { + // Because this exits before calling 'question()', + // a failure to find a routing domain constitutes a send failure for both the target and its relay + let send_ts = get_aligned_timestamp(); + self.record_send_failure( + RPCKind::Question, + send_ts, + relay.clone(), + None, + None, + ); + self.record_send_failure( + RPCKind::Question, + send_ts, + target.clone(), + None, + None, + ); return Ok(NetworkResult::no_connection_other( "no routing domain for peer", - )) + )); } }; (Some(target.clone()), routing_domain)