last connection work

This commit is contained in:
John Smith 2022-08-06 13:59:50 -04:00
parent 292712671a
commit 28b3b841a3

View File

@ -78,10 +78,13 @@ impl DiscoveryContext {
#[instrument(level = "trace", skip(self), ret)] #[instrument(level = "trace", skip(self), ret)]
async fn request_public_address(&self, node_ref: NodeRef) -> Option<SocketAddress> { async fn request_public_address(&self, node_ref: NodeRef) -> Option<SocketAddress> {
let rpc = self.routing_table.rpc_processor(); let rpc = self.routing_table.rpc_processor();
// Ensure we ask for a fresh connection
node_ref.clear_last_connection();
let res = network_result_value_or_log!(debug match rpc.rpc_call_status(node_ref.clone()).await { let res = network_result_value_or_log!(debug match rpc.rpc_call_status(node_ref.clone()).await {
Ok(v) => v, Ok(v) => v,
Err(e) => { Err(e) => {
node_ref.clear_last_connection();
log_net!(error log_net!(error
"failed to get status answer from {:?}: {}", "failed to get status answer from {:?}: {}",
node_ref, e node_ref, e
@ -89,12 +92,10 @@ impl DiscoveryContext {
return None; return None;
} }
} => { } => {
node_ref.clear_last_connection();
return None; return None;
} }
); );
node_ref.clear_last_connection();
log_net!( log_net!(
"request_public_address {:?}: Value({:?})", "request_public_address {:?}: Value({:?})",
node_ref, node_ref,
@ -209,7 +210,6 @@ impl DiscoveryContext {
node_ref node_ref
)) ))
.unwrap_or(false); .unwrap_or(false);
node_ref.clear_last_connection();
out out
} }