From 75094bb6beff42a03795686a38f595826b635309 Mon Sep 17 00:00:00 2001 From: John Smith Date: Thu, 25 Aug 2022 19:58:47 -0400 Subject: [PATCH] eliminate race condition --- veilid-core/src/rpc_processor/mod.rs | 8 -------- veilid-core/src/rpc_processor/rpc_status.rs | 9 ++++----- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/veilid-core/src/rpc_processor/mod.rs b/veilid-core/src/rpc_processor/mod.rs index fec98d40..59461fd4 100644 --- a/veilid-core/src/rpc_processor/mod.rs +++ b/veilid-core/src/rpc_processor/mod.rs @@ -769,14 +769,6 @@ impl RPCProcessor { Ok(NetworkResult::value(())) } - async fn generate_sender_info(peer_noderef: NodeRef) -> SenderInfo { - let socket_address = peer_noderef - .last_connection() - .await - .map(|c| c.remote_address().clone()); - SenderInfo { socket_address } - } - ////////////////////////////////////////////////////////////////////// #[instrument(level = "trace", skip(self, encoded_msg), err)] async fn process_rpc_message_version_0( diff --git a/veilid-core/src/rpc_processor/rpc_status.rs b/veilid-core/src/rpc_processor/rpc_status.rs index 82cc8d72..d4041f3b 100644 --- a/veilid-core/src/rpc_processor/rpc_status.rs +++ b/veilid-core/src/rpc_processor/rpc_status.rs @@ -84,7 +84,6 @@ impl RPCProcessor { #[instrument(level = "trace", skip(self, msg), fields(msg.operation.op_id, res), err)] pub(crate) async fn process_status_q(&self, msg: RPCMessage) -> Result<(), RPCError> { - let peer_noderef = msg.header.peer_noderef.clone(); let connection_descriptor = msg.header.connection_descriptor; // Get the question @@ -106,11 +105,11 @@ impl RPCProcessor { // Make status answer let node_status = self.network_manager().generate_node_status(); - // Filter the noderef down to the protocol used by the incoming connection - let filtered_peer_noderef = - peer_noderef.filtered_clone(connection_descriptor.make_dial_info_filter()); + // Get the peer address in the returned sender info - let sender_info = Self::generate_sender_info(filtered_peer_noderef).await; + let sender_info = SenderInfo { + socket_address: Some(*connection_descriptor.remote_address()), + }; let status_a = RPCOperationStatusA { node_status,