node search fix

This commit is contained in:
Christien Rioux 2023-09-16 14:57:04 -04:00
parent d4221bff77
commit eda99bbd47
3 changed files with 7 additions and 11 deletions

View File

@ -404,7 +404,7 @@ impl NetworkConnection {
} }
pub fn debug_print(&self, cur_ts: Timestamp) -> String { pub fn debug_print(&self, cur_ts: Timestamp) -> String {
format!("{} <- {} | {:x} | est {} sent {} rcvd {}", format!("{} <- {} | {} | est {} sent {} rcvd {}",
self.descriptor.remote_address(), self.descriptor.remote_address(),
self.descriptor.local().map(|x| x.to_string()).unwrap_or("---".to_owned()), self.descriptor.local().map(|x| x.to_string()).unwrap_or("---".to_owned()),
self.connection_id.as_u64(), self.connection_id.as_u64(),

View File

@ -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 /// If no node was found in the timeout, this returns None
async fn search_dht_single_key( async fn search_for_node_id(
&self, &self,
node_id: TypedKey, node_id: TypedKey,
count: usize, count: usize,
@ -561,7 +561,7 @@ impl RPCProcessor {
// Search in preferred cryptosystem order // Search in preferred cryptosystem order
let nr = match this 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 .await
{ {
TimeoutOr::Timeout => None, 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) Ok(nr)
}) })
} }

View File

@ -1661,6 +1661,7 @@ attach
detach detach
restart network restart network
contact <node>[<modifiers>] contact <node>[<modifiers>]
resolve <destination>
ping <destination> ping <destination>
appmessage <destination> <data> appmessage <destination> <data>
appcall <destination> <data> appcall <destination> <data>
@ -1748,6 +1749,8 @@ record list <local|remote>
self.debug_app_call(rest).await self.debug_app_call(rest).await
} else if arg == "appreply" { } else if arg == "appreply" {
self.debug_app_reply(rest).await self.debug_app_reply(rest).await
} else if arg == "resolve" {
self.debug_resolve(rest).await
} else if arg == "contact" { } else if arg == "contact" {
self.debug_contact(rest).await self.debug_contact(rest).await
} else if arg == "nodeinfo" { } else if arg == "nodeinfo" {