From eda99bbd47a94c7a57f12d702c20e82036660aa3 Mon Sep 17 00:00:00 2001 From: Christien Rioux Date: Sat, 16 Sep 2023 14:57:04 -0400 Subject: [PATCH] node search fix --- .../src/network_manager/network_connection.rs | 2 +- veilid-core/src/rpc_processor/mod.rs | 13 +++---------- veilid-core/src/veilid_api/debug.rs | 3 +++ 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/veilid-core/src/network_manager/network_connection.rs b/veilid-core/src/network_manager/network_connection.rs index 0b73bc6c..59f1a018 100644 --- a/veilid-core/src/network_manager/network_connection.rs +++ b/veilid-core/src/network_manager/network_connection.rs @@ -404,7 +404,7 @@ impl NetworkConnection { } pub fn debug_print(&self, cur_ts: Timestamp) -> String { - format!("{} <- {} | {:x} | est {} sent {} rcvd {}", + format!("{} <- {} | {} | est {} sent {} rcvd {}", self.descriptor.remote_address(), self.descriptor.local().map(|x| x.to_string()).unwrap_or("---".to_owned()), self.connection_id.as_u64(), diff --git a/veilid-core/src/rpc_processor/mod.rs b/veilid-core/src/rpc_processor/mod.rs index 63510ab0..fbcf2bf2 100644 --- a/veilid-core/src/rpc_processor/mod.rs +++ b/veilid-core/src/rpc_processor/mod.rs @@ -453,9 +453,9 @@ impl RPCProcessor { ////////////////////////////////////////////////////////////////////// - /// Search the DHT for a single node and add it to the routing table and return the node reference + /// Search the network for a single node and add it to the routing table and return the node reference /// If no node was found in the timeout, this returns None - async fn search_dht_single_key( + async fn search_for_node_id( &self, node_id: TypedKey, count: usize, @@ -561,7 +561,7 @@ impl RPCProcessor { // Search in preferred cryptosystem order let nr = match this - .search_dht_single_key(node_id, node_count, fanout, timeout, safety_selection) + .search_for_node_id(node_id, node_count, fanout, timeout, safety_selection) .await { TimeoutOr::Timeout => None, @@ -571,13 +571,6 @@ impl RPCProcessor { } }; - if let Some(nr) = &nr { - if nr.node_ids().contains(&node_id) { - // found a close node, but not exact within our configured resolve_node timeout - return Ok(None); - } - } - Ok(nr) }) } diff --git a/veilid-core/src/veilid_api/debug.rs b/veilid-core/src/veilid_api/debug.rs index e0d05661..5d633868 100644 --- a/veilid-core/src/veilid_api/debug.rs +++ b/veilid-core/src/veilid_api/debug.rs @@ -1661,6 +1661,7 @@ attach detach restart network contact [] +resolve ping appmessage appcall @@ -1748,6 +1749,8 @@ record list self.debug_app_call(rest).await } else if arg == "appreply" { self.debug_app_reply(rest).await + } else if arg == "resolve" { + self.debug_resolve(rest).await } else if arg == "contact" { self.debug_contact(rest).await } else if arg == "nodeinfo" {