From c68008aa04c0e8a5cc094002773cda46d9d2ca5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kl=C3=A4hn?= Date: Sun, 19 May 2024 18:12:07 +0000 Subject: [PATCH] feat(peer_channels): call update_endpoints --- src/peer_channels.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/peer_channels.rs b/src/peer_channels.rs index bf5059253..988ee8b19 100644 --- a/src/peer_channels.rs +++ b/src/peer_channels.rs @@ -25,6 +25,7 @@ use anyhow::{anyhow, Context as _, Result}; use email::Header; +use futures_lite::StreamExt; use iroh_gossip::net::{Gossip, JoinTopicFut, GOSSIP_ALPN}; use iroh_gossip::proto::{Event as IrohEvent, TopicId}; use iroh_net::relay::{RelayMap, RelayUrl}; @@ -246,6 +247,15 @@ impl Context { // Shuts down on deltachat shutdown tokio::spawn(endpoint_loop(context, endpoint.clone(), gossip.clone())); + let endp = endpoint.clone(); + let gsp = gossip.clone(); + tokio::spawn(async move { + let mut stream = endp.local_endpoints(); + while let Some(endpoints) = stream.next().await { + gsp.update_endpoints(&endpoints)?; + } + anyhow::Ok(()) + }); Ok(Iroh { endpoint, gossip,