feat: prune old, inactive paths#3666
Merged
ramfox merged 18 commits intofeat-multipathfrom Dec 2, 2025
Merged
Conversation
|
Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3666/docs/iroh/ Last updated: 2025-12-02T17:16:02Z |
matheus23
reviewed
Nov 20, 2025
Member
Author
|
@flub can I merge into |
matheus23
approved these changes
Nov 25, 2025
Member
matheus23
left a comment
There was a problem hiding this comment.
With the previous comments addressed, this is good to go from my side.
Sorry that I effectively blocked this so long that we ended up with a bigger merge conflict :S
flub
reviewed
Nov 27, 2025
Contributor
flub
left a comment
There was a problem hiding this comment.
Logic to prune seems ok. Though haven't really reviewed since the diff seems off, probably because the target branch has moved under your feet...
Member
Author
|
@flub this is reviewable now w/ rebases same tests failing here that fail on |
flub
approved these changes
Dec 2, 2025
…` method, and called it whenever new paths are added
added 14 commits
December 2, 2025 10:01
…unched this connection
also, rename `insert` to `insert_open_path` and mark the `path_state.status = PathStatus::Open`
dignifiedquire
approved these changes
Dec 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Whenever we insert a new path, trigger pruning paths.
We currently only prune IP paths, and pruning paths only occurs if we have more than 30 IP paths.
We will prune any paths that did not successfully holepunch.
If there are still over 30 IP paths left, then we order the "inactive" paths (paths that have been closed, but at one point holepunched), and prune the paths that were closed earliest.
Notes and Questions
MAX_IP_PATHS= 30 - maximum IP paths per endpointMAX_INACTIVE_IP_PATHS= 10 - maximum inactive IP paths to keepPathStatefield:status- tracks thePathStatusof the pathPathStatusenum:PathStatus::Open- is an open pathPathStatus::Inactive(Instant)- was opened once, but currently inactivePathStatus::Unusable- we attempted to use it, but it never connectedPathStatus::Unknown- we don't know the status yetRemotePathState:abandoned_path- marks a path as abandoned with timestamp, triggered when we get thePathEvent::Abandonedeventprune_paths- triggers path pruning, occurs whenever we insert a path to theRemotePathStateinserttoinsert_open_pathprune_ip_pathsfunction with sophisticated logic:MAX_IP_PATHSsuccessful
MAX_IP_PATHSinstead of pruning everything