Skip to content

refactor(iroh): Split RemoteStateActor struct into connections and state#4268

Open
Frando wants to merge 5 commits into
mainfrom
Frando/remote-state-refactor
Open

refactor(iroh): Split RemoteStateActor struct into connections and state#4268
Frando wants to merge 5 commits into
mainfrom
Frando/remote-state-refactor

Conversation

@Frando
Copy link
Copy Markdown
Member

@Frando Frando commented May 15, 2026

Description

By splitting the RemoteStateActor struct into connections and state, we can write and use util methods on state while also mutably borrowing into connections. This e.g. allows us to have open_path_on_conn to repeat less code.

Breaking Changes

Notes & open questions

The PR is best reviewed commit-by-commit. Only the last commit moves code around so that there is a single impl block for State and RemoteStateActor each.

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

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

Last updated: 2026-05-15T14:37:43Z

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 15, 2026

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: 70d34b8

@n0bot n0bot Bot added this to iroh May 15, 2026
@github-project-automation github-project-automation Bot moved this to 🚑 Needs Triage in iroh May 15, 2026
Copy link
Copy Markdown
Contributor

@flub flub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks fine.

fn select_best_path<'a>(
all_paths: FxHashMap<&'a transports::Addr, PathSelectionData>,
current_path: Option<&'a transports::Addr>,
) -> Option<(transports::Addr, Duration)> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you not return Option<(&'a transports::Addr, Duration)> here? Or would that not really have any impact on the use anyway?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried, but it then gets into parallel mutable borrow errors again unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🚑 Needs Triage

Development

Successfully merging this pull request may close these issues.

2 participants