diff --git a/core/src/cluster_info.rs b/core/src/cluster_info.rs index c58e86922..4badc640c 100644 --- a/core/src/cluster_info.rs +++ b/core/src/cluster_info.rs @@ -751,7 +751,7 @@ impl ClusterInfo { /// retransmit messages to a list of nodes /// # Remarks - /// We need to avoid having obj locked while doing any io, such as the `send_to` + /// We need to avoid having obj locked while doing a io, such as the `send_to` pub fn retransmit_to( obj: &Arc>, peers: &[ContactInfo], @@ -1096,7 +1096,7 @@ impl ClusterInfo { if caller.contact_info().is_none() { return vec![]; } - let mut from = caller.contact_info().cloned().unwrap(); + let from = caller.contact_info().unwrap(); if from.id == self_id { warn!( "PullRequest ignored, I'm talking to myself: me={} remoteme={}", @@ -1114,15 +1114,10 @@ impl ClusterInfo { let len = data.len(); trace!("get updates since response {}", len); let rsp = Protocol::PullResponse(self_id, data); - // The remote node may not know its public IP:PORT. Record what it looks like to us. - // This may or may not be correct for everybody, but it's better than leaving the remote with - // an unspecified address in our table - if from.gossip.ip().is_unspecified() { - inc_new_counter_debug!("cluster_info-window-request-updates-unspec-gossip", 1); - from.gossip = *from_addr; - } + // The remote node may not know its public IP:PORT. Instead of responding to the caller's + // gossip addr, respond to the origin addr. inc_new_counter_debug!("cluster_info-pull_request-rsp", len); - to_shared_blob(rsp, from.gossip).ok().into_iter().collect() + to_shared_blob(rsp, *from_addr).ok().into_iter().collect() } fn handle_pull_response(me: &Arc>, from: &Pubkey, data: Vec) { diff --git a/gossip/src/main.rs b/gossip/src/main.rs index 602db4c5f..a80963bbc 100644 --- a/gossip/src/main.rs +++ b/gossip/src/main.rs @@ -41,12 +41,6 @@ fn main() -> Result<(), Box> { SubCommand::with_name("spy") .about("Monitor the gossip entrypoint") .setting(AppSettings::DisableVersion) - .arg( - clap::Arg::with_name("pull_only") - .long("pull-only") - .takes_value(false) - .help("Use a partial gossip node (Pulls only) to spy on the cluster. By default it will use a full fledged gossip node (Pushes and Pulls). Useful when behind a NAT"), - ) .arg( Arg::with_name("num_nodes") .short("N") @@ -120,9 +114,7 @@ fn main() -> Result<(), Box> { .value_of("node_pubkey") .map(|pubkey_str| pubkey_str.parse::().unwrap()); - let gossip_addr = if matches.is_present("pull_only") { - None - } else { + let gossip_addr = { let mut addr = socketaddr_any!(); addr.set_ip( solana_netutil::get_public_ip_addr(&entrypoint_addr).unwrap_or_else(|err| {