Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(iroh-net): Make a single direct address in NodeAddr instant (#2580)
## Description In #2509 (c1c3539) we removed chosing a random unconfirmed direct address and through both it and the relay if we did not yet have any confirmed direct address. This required any direct address passed in via a NodeAddr to do a DISCO Ping-Pong round trip before it would be used. It turns out this is used a lot in the sense that a common socket address is used: when you know an IP is reachable. Requiring a ping would mean the first QUIC packets would be dropped, Quinn would wait to detect this before retrying and connections are delayed by an observable second by the end of it all. Not great for this scenario, even if it can be argued that outside of tests this is not a common scenario. So this brings back the random selection of unconfirmed addresses. It tries to do this without adding more complexity to the NodeState. Instead it consolidates the path information and best address into the NodeUdpState struct. But **without any logic changes.** It then adds just this extra caching of the chosen address to this struct. This is a huge simplification of a much larger refactor I was trying to do first. I believe that was the right track but resulted in too many changes to do in one large PR. So the long-term goal here is to continue removing state manipulation outside of NodeUdpState struct so that it gains more control of how to manage the UDP paths. This will help the logic of how UDP paths are chosen to be based entirely on the PathState - which is the right model for this. ## Breaking Changes None ## Notes & open questions Fixed #2546 ## Change checklist - [x] Self-review. - [x] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [x] Tests if relevant. - [x] All breaking changes documented.
- Loading branch information