Skip to content

Commit

Permalink
Merge pull request #1690 from ljedrz/testnet3_mutli_connect
Browse files Browse the repository at this point in the history
Allow multiple addresses when using --connect
  • Loading branch information
howardwu authored Mar 22, 2022
2 parents 6b7d095 + 7d8decb commit 5052ef4
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions snarkos/node.rs
Original file line number Diff line number Diff line change
@@ -196,9 +196,17 @@ impl Node {
let _display = Display::<N, E>::start(server.clone(), self.verbosity)?;
};

// Connect to a peer if one was given as an argument.
if let Some(peer_ip) = &self.connect {
let _ = server.connect_to(peer_ip.parse().unwrap()).await;
// Connect to peer(s) if given as an argument.
if let Some(peer_ips) = &self.connect {
for peer_ip in peer_ips.split(',') {
let addr: SocketAddr = if let Ok(addr) = peer_ip.parse() {
addr
} else {
error!("The address supplied to --connect ('{}') is malformed.", peer_ip);
continue;
};
let _ = server.connect_to(addr).await;
}
}

// Note: Do not move this. The pending await must be here otherwise

0 comments on commit 5052ef4

Please sign in to comment.