eliminate race condition

This commit is contained in:
John Smith 2022-08-25 19:58:47 -04:00
parent f83e1d2680
commit 75094bb6be
2 changed files with 4 additions and 13 deletions

View File

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

View File

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