This commit is contained in:
Sebastian Klähn
2024-01-29 16:12:45 +01:00
parent eca8ed3d56
commit 4fb0002283
3 changed files with 9 additions and 12 deletions

View File

@@ -191,9 +191,11 @@ async fn subscribe_loop(
let event = stream.recv().await?;
match event {
IrohEvent::NeighborUp(node) => {
info!(context, "NeighborUp: {:?}", node);
context.add_peer_for_topic(msg_id, topic, node).await?;
}
IrohEvent::NeighborDown(node) => {
info!(context, "NeighborDown: {:?}", node);
context.delete_peer_for_topic(topic, node).await?;
}
IrohEvent::Received(event) => {

View File

@@ -441,11 +441,6 @@ pub(crate) async fn receive_imf_inner(
// join advertised gossip topics
Ok((topics, instance_id)) => {
warn!(context, "Joining topics: {:#?}", topics);
warn!(
context,
"{:?}",
mime_parser.get_header(HeaderDef::IrohPublicGossip)
);
if let Some(node_addr) = mime_parser.get_header(HeaderDef::IrohPublicGossip) {
match serde_json::from_str::<NodeAddr>(node_addr)
.context("Failed to parse node address")

View File

@@ -515,14 +515,13 @@ impl Context {
let topic = TopicId::from_str(&iroh_base::base32::fmt(
topic.get(0..32).context("Can't get 32 bytes from topic")?,
))?;
self.join_and_subscribe_topic(topic, instance_msg_id)
.await?;
if !topic_exists {
info!(
self,
"Gossip topic {topic} does not exist, sending over smtp",
);
let addr = self
let node_id = self
.endpoint
.lock()
.await
@@ -530,9 +529,11 @@ impl Context {
.unwrap()
.my_addr()
.await
.unwrap();
self.add_peer_for_topic(instance_msg_id, topic, addr.node_id)
.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?;
ephemeral = false;
} else {
@@ -940,7 +941,6 @@ pub async fn join_gossip_topic(ctx: &Context, msg_id: MsgId, topic: &str) -> Res
let topic = TopicId::from_str(&iroh_base::base32::fmt(
topic.get(0..32).context("Can't get 32 bytes from topic")?,
))?;
info!(ctx, "Received join request from frontend");
ctx.join_and_subscribe_topic(topic, msg_id).await
}