fix: only add node addrs with actual information

This commit is contained in:
dignifiedquire
2024-07-09 21:20:24 +02:00
committed by link2xt
parent cc51d51a78
commit c2d5488663

View File

@@ -103,21 +103,22 @@ impl Iroh {
}; };
let peers = get_iroh_gossip_peers(ctx, msg_id).await?; let peers = get_iroh_gossip_peers(ctx, msg_id).await?;
let node_ids = peers.iter().map(|p| p.node_id).collect::<Vec<_>>();
info!( info!(
ctx, ctx,
"IROH_REALTIME: Joining gossip with peers: {:?}", "IROH_REALTIME: Joining gossip with peers: {:?}", node_ids,
peers.iter().map(|p| p.node_id).collect::<Vec<_>>()
); );
// Connect to all peers // Inform iroh of potentially new node addresses
for peer in &peers { for node_addr in &peers {
self.endpoint.add_node_addr(peer.clone())?; if !node_addr.info.is_empty() {
self.endpoint.add_node_addr(node_addr.clone())?;
}
} }
let connect_future = self // Connect to all peers
.gossip let connect_future = self.gossip.join(topic, node_ids).await?;
.join(topic, peers.into_iter().map(|addr| addr.node_id).collect())
.await?;
let ctx = ctx.clone(); let ctx = ctx.clone();
let gossip = self.gossip.clone(); let gossip = self.gossip.clone();