retains peer's contact-info when making pull requests (#16715)

ClusterInfo::new_pull_requests has to lookup contact-infos:
https://github.com/solana-labs/solana/blob/a1ef2bd74/core/src/cluster_info.rs#L1663-L1673

when it was already available when making pull requests:
https://github.com/solana-labs/solana/blob/a1ef2bd74/core/src/crds_gossip_pull.rs#L232
This commit is contained in:
behzad nouri
2021-04-28 13:19:12 +00:00
committed by GitHub
parent 1eaff394da
commit 25054bfd35
5 changed files with 92 additions and 100 deletions

View File

@ -423,7 +423,8 @@ fn network_run_pull(
network_values
.par_iter()
.filter_map(|from| {
from.lock()
let (peer, filters) = from
.lock()
.unwrap()
.new_pull_request(
&thread_pool,
@ -432,7 +433,11 @@ fn network_run_pull(
&HashMap::new(),
cluster_info::MAX_BLOOM_SIZE,
)
.ok()
.ok()?;
let gossip = from.gossip.lock().unwrap();
let label = CrdsValueLabel::ContactInfo(gossip.id);
let self_info = gossip.crds.get(&label).unwrap().value.clone();
Some((peer.id, filters, self_info))
})
.collect()
};
@ -478,7 +483,7 @@ fn network_run_pull(
msgs += rsp.len();
if let Some(node) = network.get(&from) {
let mut node = node.lock().unwrap();
node.mark_pull_request_creation_time(&from, now);
node.mark_pull_request_creation_time(from, now);
let mut stats = ProcessPullStats::default();
let (vers, vers_expired_timeout, failed_inserts) =
node.filter_pull_responses(&timeouts, rsp, now, &mut stats);