From c3639fd331eec8338f10ab46219cdbbca013c42b Mon Sep 17 00:00:00 2001 From: John Smith Date: Sun, 25 Jun 2023 17:59:11 -0400 Subject: [PATCH] fix nodecontactmethod cache --- veilid-core/src/network_manager/mod.rs | 3 ++- veilid-core/src/network_manager/send_data.rs | 10 ++++++++++ veilid-core/src/rpc_processor/mod.rs | 2 +- veilid-tools/src/network_result.rs | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/veilid-core/src/network_manager/mod.rs b/veilid-core/src/network_manager/mod.rs index 778dbe40..1cfe69df 100644 --- a/veilid-core/src/network_manager/mod.rs +++ b/veilid-core/src/network_manager/mod.rs @@ -110,6 +110,7 @@ struct NodeContactMethodCacheKey { own_node_info_ts: Option, target_node_info_ts: Timestamp, target_node_ref_filter: Option, + target_node_ref_sequencing: Sequencing, } #[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)] @@ -817,7 +818,7 @@ impl NetworkManager { let destination_node_ref = destination_node_ref.as_ref().unwrap_or(&node_ref).clone(); if !node_ref.same_entry(&destination_node_ref) { - log_net!( + log_net!( "sending envelope to {:?} via {:?}", destination_node_ref, node_ref diff --git a/veilid-core/src/network_manager/send_data.rs b/veilid-core/src/network_manager/send_data.rs index 063d4f19..49685b12 100644 --- a/veilid-core/src/network_manager/send_data.rs +++ b/veilid-core/src/network_manager/send_data.rs @@ -31,6 +31,11 @@ impl NetworkManager { cm => (cm, target_node_ref.clone(), false), }; + info!( + "ContactMethod: {:?} for {:?}", + contact_method, target_node_ref + ); + // Try the contact method let sdk = match contact_method { NodeContactMethod::OutboundRelay(relay_nr) @@ -242,6 +247,10 @@ impl NetworkManager { // First try to send data to the last socket we've seen this peer on let data = if let Some(connection_descriptor) = node_ref.last_connection() { + info!( + "ExistingConnection: {:?} for {:?}", + connection_descriptor, node_ref + ); match self .net() .send_data_to_existing_connection(connection_descriptor, data) @@ -296,6 +305,7 @@ impl NetworkManager { own_node_info_ts: routing_table.get_own_node_info_ts(routing_domain), target_node_info_ts: target_node_ref.node_info_ts(routing_domain), target_node_ref_filter: target_node_ref.filter_ref().cloned(), + target_node_ref_sequencing: target_node_ref.sequencing(), }; if let Some(ncm) = self.inner.lock().node_contact_method_cache.get(&ncm_key) { return Ok(ncm.clone()); diff --git a/veilid-core/src/rpc_processor/mod.rs b/veilid-core/src/rpc_processor/mod.rs index 02f1d140..d2ffaa44 100644 --- a/veilid-core/src/rpc_processor/mod.rs +++ b/veilid-core/src/rpc_processor/mod.rs @@ -1228,7 +1228,7 @@ impl RPCProcessor { let operation = RPCOperation::new_statement(statement, spi); // Log rpc send - trace!(target: "rpc_message", dir = "send", kind = "statement", op_id = operation.op_id().as_u64(), desc = operation.kind().desc(), ?dest); + info!(target: "rpc_message", dir = "send", kind = "statement", op_id = operation.op_id().as_u64(), desc = operation.kind().desc(), ?dest); // Produce rendered operation let RenderedOperation { diff --git a/veilid-tools/src/network_result.rs b/veilid-tools/src/network_result.rs index 905a8b5f..ef782a1c 100644 --- a/veilid-tools/src/network_result.rs +++ b/veilid-tools/src/network_result.rs @@ -328,7 +328,7 @@ macro_rules! network_result_try { macro_rules! log_network_result { ($text:expr) => { cfg_if::cfg_if! { - if #[cfg(feature="network-result-info")] { + if #[cfg(feature="network-result-extra")] { info!(target: "network_result", "{}", format!("{}", $text)) } else { debug!(target: "network_result", "{}", format!("{}", $text)) @@ -337,7 +337,7 @@ macro_rules! log_network_result { }; ($fmt:literal, $($arg:expr),+) => { cfg_if::cfg_if! { - if #[cfg(feature="network-result-info")] { + if #[cfg(feature="network-result-extra")] { info!(target: "network_result", "{}", format!($fmt, $($arg),+)); } else { debug!(target: "network_result", "{}", format!($fmt, $($arg),+));