fix(iroh): actually use user-provided bind addrs#3835
Conversation
iroh/src/endpoint.rs
Outdated
| let bound_sockets = ep.bound_sockets(); | ||
| assert_eq!(bound_sockets.len(), 1); | ||
| assert!(bound_sockets[0].is_ipv4()); | ||
| assert_eq!(bound_sockets[0].port(), port); |
There was a problem hiding this comment.
Unfortunately that isn't guaranteed I think. If the port is already in-use, we use a fallback.
There was a problem hiding this comment.
Changed to port 0 and binding to LOCALHOST instead to test difference to the default unspecified bind.
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3835/docs/iroh/ Last updated: 2026-01-09T09:56:32Z |
iroh/src/endpoint.rs
Outdated
| // test 2: do not clear ip transports and add single non-default IPv4 bind | ||
| // this will bind three sockets: wildcard binds for IPv4 and IPv6, and our | ||
| // manually-added IPv4 bind. |
There was a problem hiding this comment.
I'm personally a fan of separating the tests into individual test fns 👀
iroh/src/endpoint.rs
Outdated
| // are free immediately after the endpoint is dropped. | ||
|
|
||
| // test 1: clear ip transports and add single IPv4 bind | ||
| let port: u16 = 12345; |
There was a problem hiding this comment.
I'd strongly recommend to use 0 for port numbers in the test. I don't think your test cares about ports. And hardcoding ports will be flaky at some point.
There was a problem hiding this comment.
Changed to port 0 and binding to LOCALHOST instead to test difference to the default unspecified bind.
Description
The new user-defined IP transports added #3692 don't actually work because they are filtered out in
Transports::bind.Here's a fix, and a test that tests the currently implemented behavior. The test fails without this fix.
Breaking Changes
Notes & open questions
Change checklist
quic-rpciroh-gossipiroh-blobsdumbpipesendme