Skip to content

Conversation

dignifiedquire
Copy link
Contributor

Description

Starting to fix #3329, and trying to cleanup discovery interactions while at it

Breaking Changes

TODO

@n0bot n0bot bot added this to iroh Jun 3, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Jun 3, 2025
@Frando
Copy link
Member

Frando commented Jun 3, 2025

Currently iroh-gossip uses Endpoint::add_node_addr to inject node info received via gossip into the endpoint. There's a PR in iroh-gossip that uses a gossip-specific discovery service instead: n0-computer/iroh-gossip#51

let recv = self.inner.subscribe();
BroadcastStream::new(recv).map_err(|BroadcastStreamRecvError::Lagged(n)| Lagged { val: n })
pub(crate) fn subscribe(&self) -> impl Stream<Item = Option<DiscoveryItem>> {
self.inner.watch().stream()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC this is a quite big behaviour change: previously you'd have a reasonable chance of seeing all discovered items, now you only get a single one. Especially the ConcurrentDiscovery this could be an issue if multiple discovery services find something at the same time you'll miss one address.

/// [`MdnsDiscovery`]: crate::discovery::mdns::MdnsDiscovery
/// [`StaticProvider`]: crate::discovery::static_provider::StaticProvider
pub fn discovery_stream(&self) -> impl Stream<Item = Result<DiscoveryItem, Lagged>> {
pub fn discovery_stream(&self) -> impl Stream<Item = Option<DiscoveryItem>> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just from looking at the signature change I think the old API was more correct here as well?

@github-project-automation github-project-automation bot moved this from 🏗 In progress to ✅ Done in iroh Jun 3, 2025
@dignifiedquire
Copy link
Contributor Author

this doesn't work as I would like it to..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

remove endpoint::Builder::known_nodes

3 participants