n0-computer / iroh

A toolkit for building distributed applications
https://iroh.computer
Apache License 2.0
2.14k stars 138 forks source link

Add timeouts to discovery #2321

Open ramfox opened 1 month ago

ramfox commented 1 month ago

Discovery currently works quickly because our current DNS setup works well. But in theory, especially if someone writes a distributed version of discovery, this can be very slow. In the IPFS paradigm, this also often led to confusion—am I not connecting because the address I received from Discovery did not work, OR did Discovery still not respond?

We should ensure we have a reasonable timeout for discovery.

divagant-martian commented 1 month ago

This uses the default timeout in hickory, which is 5seconds. After retries in practice this is about 10seconds total

ramfox commented 1 month ago

We have timeouts in our implementation of the discovery trait, but we should include timeouts in our DiscoveryTask (which spawns and runs discovery) so that if other implementations of Discovery don't have timeouts, we have an escape hatch.