-
Notifications
You must be signed in to change notification settings - Fork 323
feat: prune old, inactive paths #3666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
|
@flub can I merge into |
matheus23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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...
|
@flub this is reviewable now w/ rebases same tests failing here that fail on |
…` method, and called it whenever new paths are added
…unched this connection
also, rename `insert` to `insert_open_path` and mark the `path_state.status = PathStatus::Open`
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