diff --git a/src/peer_channels.rs b/src/peer_channels.rs index 97d574c79..bffae3a3d 100644 --- a/src/peer_channels.rs +++ b/src/peer_channels.rs @@ -22,7 +22,7 @@ impl Context { if self.endpoint.lock().await.is_some() { warn!( self, - "Tried to create gossip even tough there still exists an instance" + "Tried to create endpoint even though there is already one." ); return Ok(()); } diff --git a/src/webxdc.rs b/src/webxdc.rs index 357e52611..519c06141 100644 --- a/src/webxdc.rs +++ b/src/webxdc.rs @@ -501,6 +501,11 @@ impl Context { if send_now { if let Some(ref topic) = status_update.gossip_topic { // find out if any row with `topic = topic` exists in the gossip_peers table + + let topic = TopicId::from_str(&iroh_base::base32::fmt( + topic.get(0..32).context("Can't get 32 bytes from topic")?, + ))?; + let topic_exists = self .sql .query_row_optional( @@ -512,10 +517,6 @@ impl Context { .context("Failed to check if gossip topic exists")? .is_some(); - let topic = TopicId::from_str(&iroh_base::base32::fmt( - topic.get(0..32).context("Can't get 32 bytes from topic")?, - ))?; - if !topic_exists { info!( self, @@ -531,10 +532,10 @@ impl Context { .await .unwrap() .node_id; - self.join_and_subscribe_topic(topic, instance_msg_id) - .await?; self.add_peer_for_topic(instance_msg_id, topic, node_id) .await?; + self.join_and_subscribe_topic(topic, instance_msg_id) + .await?; ephemeral = false; } else { if let Some(ref gossip) = *self.gossip.lock().await {