fix nodecontactmethod cache

This commit is contained in:
John Smith 2023-06-25 17:59:11 -04:00
parent 297908796c
commit c3639fd331
4 changed files with 15 additions and 4 deletions

View File

@ -110,6 +110,7 @@ struct NodeContactMethodCacheKey {
own_node_info_ts: Option<Timestamp>, own_node_info_ts: Option<Timestamp>,
target_node_info_ts: Timestamp, target_node_info_ts: Timestamp,
target_node_ref_filter: Option<NodeRefFilter>, target_node_ref_filter: Option<NodeRefFilter>,
target_node_ref_sequencing: Sequencing,
} }
#[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Ord, PartialOrd, Hash)]

View File

@ -31,6 +31,11 @@ impl NetworkManager {
cm => (cm, target_node_ref.clone(), false), cm => (cm, target_node_ref.clone(), false),
}; };
info!(
"ContactMethod: {:?} for {:?}",
contact_method, target_node_ref
);
// Try the contact method // Try the contact method
let sdk = match contact_method { let sdk = match contact_method {
NodeContactMethod::OutboundRelay(relay_nr) 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 // 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() { let data = if let Some(connection_descriptor) = node_ref.last_connection() {
info!(
"ExistingConnection: {:?} for {:?}",
connection_descriptor, node_ref
);
match self match self
.net() .net()
.send_data_to_existing_connection(connection_descriptor, data) .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), 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_info_ts: target_node_ref.node_info_ts(routing_domain),
target_node_ref_filter: target_node_ref.filter_ref().cloned(), 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) { if let Some(ncm) = self.inner.lock().node_contact_method_cache.get(&ncm_key) {
return Ok(ncm.clone()); return Ok(ncm.clone());

View File

@ -1228,7 +1228,7 @@ impl RPCProcessor {
let operation = RPCOperation::new_statement(statement, spi); let operation = RPCOperation::new_statement(statement, spi);
// Log rpc send // 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 // Produce rendered operation
let RenderedOperation { let RenderedOperation {

View File

@ -328,7 +328,7 @@ macro_rules! network_result_try {
macro_rules! log_network_result { macro_rules! log_network_result {
($text:expr) => { ($text:expr) => {
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(feature="network-result-info")] { if #[cfg(feature="network-result-extra")] {
info!(target: "network_result", "{}", format!("{}", $text)) info!(target: "network_result", "{}", format!("{}", $text))
} else { } else {
debug!(target: "network_result", "{}", format!("{}", $text)) debug!(target: "network_result", "{}", format!("{}", $text))
@ -337,7 +337,7 @@ macro_rules! log_network_result {
}; };
($fmt:literal, $($arg:expr),+) => { ($fmt:literal, $($arg:expr),+) => {
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(feature="network-result-info")] { if #[cfg(feature="network-result-extra")] {
info!(target: "network_result", "{}", format!($fmt, $($arg),+)); info!(target: "network_result", "{}", format!($fmt, $($arg),+));
} else { } else {
debug!(target: "network_result", "{}", format!($fmt, $($arg),+)); debug!(target: "network_result", "{}", format!($fmt, $($arg),+));