Skip to content

fix: Endpoint::node_addr completes with direct addrs or relay ready #3190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Frando
Copy link
Member

@Frando Frando commented Feb 19, 2025

Description

Currently, Endpoint::node_addr waits for the endpoint's direct addresses to be initialized, and then returns. This is an issue for iroh in the browser, because there we never have direct addresses.

This PR changes the behavior of Endpoint::node_addr so that it completes once either the direct addresses or the home relay URL are initialized.

Breaking Changes

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

@Frando Frando changed the title fix: Endpoint::node_addr completes with direct addrs or relay ready fix: Endpoint::node_addr completes with direct addrs or relay ready Feb 19, 2025
@Frando Frando force-pushed the Frando/node-addr-race branch from 355a992 to e044fcd Compare February 19, 2025 10:39
Copy link

github-actions bot commented Feb 19, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3190/docs/iroh/

Last updated: 2025-02-19T11:47:21Z

Copy link
Member

@matheus23 matheus23 left a comment

Choose a reason for hiding this comment

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

IMHO we could also make node_addr infallible, because all the ? only fail when the Watchers are disconnected. Which should be impossible, given we have a &self reference alive, which holds the respective Watchable at the same time.

If there's errors while getting the home relay or direct addresses, these errors aren't propagated to here anyways - instead it'll fail to resolve :/


We should probably also be a little careful with this change and see how much it affects - I hope I don't misremember the history & intention here, I think the intention was to wait for either - and I hope I wasn't wrong 😬

Copy link

github-actions bot commented Feb 19, 2025

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 418b10a

@Frando
Copy link
Member Author

Frando commented Feb 19, 2025

One test in iroh needed fixing for this. I am still not totally convinced that this is the right approach. See #3192 for an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

2 participants