subscribe before join

This commit is contained in:
dignifiedquire
2024-05-18 16:27:33 +02:00
parent ba3bc01e1b
commit 4bcc3d22aa

View File

@@ -101,11 +101,6 @@ impl Iroh {
self.endpoint.add_node_addr(peer.clone())?; self.endpoint.add_node_addr(peer.clone())?;
} }
let connect_future = self
.gossip
.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();
let subscribe_loop = tokio::spawn(async move { let subscribe_loop = tokio::spawn(async move {
@@ -114,6 +109,11 @@ impl Iroh {
} }
}); });
let connect_future = self
.gossip
.join(topic, peers.into_iter().map(|addr| addr.node_id).collect())
.await?;
self.iroh_channels self.iroh_channels
.write() .write()
.await .await