Skip to content

Conversation

@ramfox
Copy link
Member

@ramfox ramfox commented Nov 14, 2025

Description

Prune paths that are not actively being used, never have been holepunched, are not about to be dialed, or old.

Notes and Questions

The logic of gathering all of the relevant information is in the fn prune_ip_paths function, not in the self.prune_ip_paths method on EndpointActorState. Separating these out made it easier to test.

Used AI to help write tests & reduce allocations when working through the paths.

keep_path is where we can play around with what exactly we want to keep, based on the PathState, if we want to get more strict or particular as we learn more.

I added a PathState::holepunched field that says whether or not that path was ever hole punched.

I added an Instant to the PathState::sent_ping field, so we can ensure that we don't prune paths that are currently attempting to holepunch, giving a very generous 30 seconds before deciding that the holepunch didn't work.

Right now we:

  • keep paths that are open
  • keep paths that are waiting to be opened
  • keep paths that have not ever been pinged
  • keep paths that are inactive but have hole punched before
  • keep paths that are attempting to hole punch currently
  • have at least one source that was given to us less that 2 mins ago

This means:

  • we only prune paths if they are inactive, have never successfully holepunched, and have not been given to us or connected in over 2 mins

Also, we only do prune this if there are more that 20 inactive paths open.

I've added prune_ip_paths every time we call insert the EndpointActorState::paths.

@n0bot n0bot bot added this to iroh Nov 14, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Nov 14, 2025
@matheus23 matheus23 changed the base branch from main to feat-multipath November 17, 2025 08:17
@github-actions
Copy link

github-actions bot commented Nov 17, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh/pr/3666/docs/iroh/

Last updated: 2025-11-21T17:17:19Z

@ramfox ramfox changed the title wip feat: prune old, inactive paths feat: prune old, inactive paths Nov 17, 2025
@ramfox ramfox requested a review from flub November 17, 2025 19:04
@ramfox ramfox self-assigned this Nov 17, 2025
@ramfox ramfox added this to the v0.96 milestone Nov 17, 2025
@ramfox ramfox marked this pull request as ready for review November 17, 2025 19:09
@github-actions
Copy link

github-actions bot commented Nov 21, 2025

Netsim report & logs for this PR have been generated and is available at: LOGS
This report will remain available for 3 days.

Last updated for commit: 2492e77

@ramfox ramfox requested a review from matheus23 November 21, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

3 participants