various fixes, including node_ref last_connection sorting problem
This commit is contained in:
@@ -1949,47 +1949,53 @@ impl NetworkManager {
|
||||
.clone()
|
||||
.unlocked_inner
|
||||
.node_info_update_single_future
|
||||
.single_spawn(async move {
|
||||
// Only update if we actually have valid signed node info for this routing domain
|
||||
if !this.routing_table().has_valid_own_node_info(routing_domain) {
|
||||
trace!(
|
||||
.single_spawn(
|
||||
async move {
|
||||
// Only update if we actually have valid signed node info for this routing domain
|
||||
if !this.routing_table().has_valid_own_node_info(routing_domain) {
|
||||
trace!(
|
||||
"not sending node info update because our network class is not yet valid"
|
||||
);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the list of refs to all nodes to update
|
||||
let cur_ts = intf::get_timestamp();
|
||||
let node_refs =
|
||||
this.routing_table()
|
||||
.get_nodes_needing_updates(routing_domain, cur_ts, all);
|
||||
|
||||
// Send the updates
|
||||
log_net!(debug "Sending node info updates to {} nodes", node_refs.len());
|
||||
let mut unord = FuturesUnordered::new();
|
||||
for nr in node_refs {
|
||||
let rpc = this.rpc_processor();
|
||||
unord.push(
|
||||
async move {
|
||||
// Update the node
|
||||
if let Err(e) = rpc
|
||||
.rpc_call_node_info_update(nr.clone(), routing_domain)
|
||||
.await
|
||||
{
|
||||
// Not fatal, but we should be able to see if this is happening
|
||||
trace!("failed to send node info update to {:?}: {}", nr, e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark the node as having seen our node info
|
||||
nr.set_seen_our_node_info(routing_domain);
|
||||
}
|
||||
.instrument(Span::current()),
|
||||
);
|
||||
}
|
||||
|
||||
// Wait for futures to complete
|
||||
while unord.next().await.is_some() {}
|
||||
|
||||
log_rtab!(debug "Finished sending node updates");
|
||||
}
|
||||
|
||||
// Get the list of refs to all nodes to update
|
||||
let cur_ts = intf::get_timestamp();
|
||||
let node_refs =
|
||||
this.routing_table()
|
||||
.get_nodes_needing_updates(routing_domain, cur_ts, all);
|
||||
|
||||
// Send the updates
|
||||
log_net!(debug "Sending node info updates to {} nodes", node_refs.len());
|
||||
let mut unord = FuturesUnordered::new();
|
||||
for nr in node_refs {
|
||||
let rpc = this.rpc_processor();
|
||||
unord.push(async move {
|
||||
// Update the node
|
||||
if let Err(e) = rpc
|
||||
.rpc_call_node_info_update(nr.clone(), routing_domain)
|
||||
.await
|
||||
{
|
||||
// Not fatal, but we should be able to see if this is happening
|
||||
trace!("failed to send node info update to {:?}: {}", nr, e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark the node as having seen our node info
|
||||
nr.set_seen_our_node_info(routing_domain);
|
||||
});
|
||||
}
|
||||
|
||||
// Wait for futures to complete
|
||||
while unord.next().await.is_some() {}
|
||||
|
||||
log_rtab!(debug "Finished sending node updates");
|
||||
})
|
||||
.instrument(Span::current()),
|
||||
)
|
||||
.await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user