Skip to content

Commit

Permalink
chore: resolve rebase conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
maqi committed Dec 12, 2024
1 parent e4767ff commit 91e17f9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
17 changes: 4 additions & 13 deletions ant-bootstrap/src/initial_peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,10 @@ impl PeersArgs {

let mut bootstrap_addresses = vec![];

// Read from `ANT_PEERS` environment variable if present
if let Ok(addrs) = std::env::var(ANT_PEERS_ENV) {
for addr_str in addrs.split(',') {
if let Some(addr) = craft_valid_multiaddr_from_str(addr_str, false) {
info!("Adding addr from environment variable: {addr}");
bootstrap_addresses.push(BootstrapAddr::new(addr));
} else {
warn!("Invalid multiaddress format from environment variable: {addr_str}");
}
}
// Read from ANT_PEERS environment variable if present
bootstrap_addresses.extend(Self::read_bootstrap_addr_from_env());

if !bootstrap_addresses.is_empty() {
return Ok(bootstrap_addresses);
}

Expand All @@ -150,9 +144,6 @@ impl PeersArgs {
}
}

// Read from ANT_PEERS environment variable if present
bootstrap_addresses.extend(Self::read_bootstrap_addr_from_env());

if let Some(count) = count {
if bootstrap_addresses.len() >= count {
bootstrap_addresses.sort_by_key(|addr| addr.failure_rate() as u64);
Expand Down
13 changes: 13 additions & 0 deletions ant-networking/src/event/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,19 @@ impl SwarmDriver {
} => {
event_string = "incoming";
debug!("IncomingConnection ({connection_id:?}) with local_addr: {local_addr:?} send_back_addr: {send_back_addr:?}");
// Client/Node that got peer inserted into RT manually then dial,
// will cause the peer receive such IncomingConnection Event
// Only node shall hit such situation, and currently from client only
// The peer_id is unknown, hence don't know whether dialed or not.
if !self.is_client {
if let Err(err) = self.swarm.dial(
DialOpts::unknown_peer_id()
.address(send_back_addr.clone())
.build(),
) {
warn!(?send_back_addr, "dialing error: {err:?}");
}
}
}
SwarmEvent::ConnectionEstablished {
peer_id,
Expand Down
2 changes: 1 addition & 1 deletion autonomi/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ impl Client {
let peers = if let Some(peers) = config.peers {
peers
} else {
match peers_args.get_addrs(None).await {
match peers_args.get_addrs(None, None).await {
Ok(peers) => peers,
Err(e) => return Err(e),
}
Expand Down

0 comments on commit 91e17f9

Please sign in to comment.