Skip to content

Commit

Permalink
Call Swarm::listen_on only on relay nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
artemii235 committed Dec 4, 2020
1 parent a831432 commit 19701cc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mm2src/mm2_libp2p/src/atomicdex_behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,9 @@ pub fn start_gossipsub(
};
swarm.floodsub.subscribe(FloodsubTopic::new(PEERS_TOPIC.to_owned()));
let addr = format!("/ip4/{}/tcp/{}", ip, port);
libp2p::Swarm::listen_on(&mut swarm, addr.parse().unwrap()).unwrap();
if i_am_relay {
libp2p::Swarm::listen_on(&mut swarm, addr.parse().unwrap()).unwrap();
}
for relay in bootstrap.choose_multiple(&mut thread_rng(), mesh_n) {
match libp2p::Swarm::dial_addr(&mut swarm, relay.clone()) {
Ok(_) => info!("Dialed {}", relay),
Expand Down

0 comments on commit 19701cc

Please sign in to comment.