Skip to content

Commit

Permalink
Merge branch 'main' into faucet_initial_upload_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuef authored Jun 10, 2024
2 parents f5e1ea8 + d67da92 commit 5a796dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions sn_networking/src/event/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,14 @@ impl SwarmDriver {

let has_relayed = is_a_relayed_peer(&addrs);

let is_bootstrap_peer = self
.bootstrap_peers
.iter()
.any(|(_ilog2, peers)| peers.contains(&peer_id));

// Do not use an `already relayed` peer as `potential relay candidate`.
if !has_relayed {
if !has_relayed && !is_bootstrap_peer {
debug!("Adding candidate relay server {peer_id:?}, it's not a bootstrap node");
self.relay_manager.add_potential_candidates(
&peer_id,
&addrs,
Expand Down Expand Up @@ -573,8 +579,8 @@ impl SwarmDriver {
}
let all_external_addresses = self.swarm.external_addresses().collect_vec();
let all_listeners = self.swarm.listeners().collect_vec();
debug!("All our listeners: {all_listeners:?}");
debug!("All our external addresses: {all_external_addresses:?}");
trace!("All our listeners: {all_listeners:?}");
trace!("All our external addresses: {all_external_addresses:?}");
}
SwarmEvent::ExternalAddrConfirmed { address } => {
event_string = "ExternalAddrConfirmed";
Expand Down
4 changes: 2 additions & 2 deletions sn_networking/src/relay_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use libp2p::{
use rand::Rng;
use std::collections::{BTreeMap, HashMap, HashSet, VecDeque};

const MAX_CONCURRENT_RELAY_CONNECTIONS: usize = 3;
const MAX_POTENTIAL_CANDIDATES: usize = 15;
const MAX_CONCURRENT_RELAY_CONNECTIONS: usize = 2;
const MAX_POTENTIAL_CANDIDATES: usize = 1000;

pub(crate) fn is_a_relayed_peer(addrs: &HashSet<Multiaddr>) -> bool {
addrs
Expand Down

0 comments on commit 5a796dc

Please sign in to comment.