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>,
target_node_info_ts: Timestamp,
target_node_ref_filter: Option<NodeRefFilter>,
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

View File

@ -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());

View File

@ -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 {

View File

@ -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),+));