This commit is contained in:
Sebastian Klähn
2024-02-09 09:10:56 +01:00
parent bd37c36143
commit 8385ba92c7
2 changed files with 8 additions and 7 deletions

View File

@@ -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 {