Skip to content

Commit 4b6824c

Browse files
authored
fix(iroh): Clear EndpointStateActor::selected_path once the last connection closes (#3650)
## Description Addresses #3602 for multipath. This implements the first bullet point from @flub's suggestion in the above issue: We clear the `selected_path` once the last known connection to an endpoint closes. This means that a new connection attempt after that will instead send to all addresses again, and avoids the case where we send on e.g. the old port from a previous restart of the endpoint we're connecting to. This turns the `test_0rtt_after_server_restart` test green. ## Notes & open questions I *think* this will still fail if we have an "open" connection to the server that's in the process of timing out and we open a new connection to the restarted server while that's happening. I'm not sure though. ## Change checklist <!-- Remove any that are not relevant. --> - [x] Self-review.
1 parent e7bf47d commit 4b6824c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

iroh/src/magicsock/endpoint_map/endpoint_state.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ impl EndpointStateActor {
248248
}
249249
Some(conn_id) = self.connections_close.next(), if !self.connections_close.is_empty() => {
250250
self.connections.remove(&conn_id);
251+
if self.connections.is_empty() {
252+
trace!("last connection closed - clearing selected_path");
253+
self.selected_path.set(None).ok();
254+
}
251255
}
252256
_ = self.local_addrs.updated() => {
253257
trace!("local addrs updated, triggering holepunching");

0 commit comments

Comments
 (0)