feat(iroh)!: introduce online method#3467
Conversation
flub
left a comment
There was a problem hiding this comment.
I like this approach! It's a good breakthrough on this problem.
| pub fn direct_addresses(&self) -> n0_watcher::Direct<Option<BTreeSet<DirectAddr>>> { | ||
| self.msock.direct_addresses() | ||
| /// This has no timeout, so if that is needed, you need to wrap it in a timeout. | ||
| pub async fn online(&self) { |
There was a problem hiding this comment.
Should this handle going offline again? Like when the home relay is no longer reachable it should be pending again until there's another home relay?
The docs should probably also elaborate on when and how you might want to use the endpoint without being online, like mDNS or more manual scenarios.
There was a problem hiding this comment.
Should this handle going offline again?
No, that would be very complex to do, will make it clear in the docs.
There was a problem hiding this comment.
Is it that complex? You only need a watcher on the home relay to implement this I think. If it's None: block. If it's Some(): return.
There was a problem hiding this comment.
I would need to store boxed futures, and make a new type, and stuff and manually poll things..
5db15f0 to
86a1b64
Compare
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3467/docs/iroh/ Last updated: 2025-10-06T09:28:42Z |
b915040 to
c48f700
Compare
|
Personal opinion - I think the So my preference would be that this hangs forever if there is no relay available, even if there is no relay in the relay map. This will also make sense when we allow users to allow adding a relay dynamically (after the endpoint is created). We hang until a relay is added and we make a connection to that relay, and then The question of whether this should be more like a watchable, that indicates going back offline...I can see someone wanting this or expecting this in the future, but I don't want to get farther away from what this method is supposed to be, which is porcelain for waiting for both the |
…cted to, regardless of whether you have any relay urls in your relay map
Description
A new attempt to start improving the address and boot up situation.
There is a new
onlinemethod, which simply waits for theNodeAddrto be filled, usage is easiest to see by looking at how the examples have changed.Breaking Changes
iroh::Endpoint::direct_addressesiroh::Endpoint::home_relayiroh::Endpoint::node_addrnow returns synchronously the current addressing informationiroh::Endpoint::onlineiroh::Endpoint::watch_node_addr