Skip to content

refactor(iroh, iroh-relay)!: Do reconnection in ActiveRelayActor #3058

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

Merged
merged 4 commits into from
Dec 18, 2024

Conversation

flub
Copy link
Contributor

@flub flub commented Dec 17, 2024

Description

This moves the reconnection logic ingo ActiveRelayActor instead of
doing this in the RelayActor. The logic itself is not really changed.
This does simplify things a fair bit though, it is a lot easier to do
this in one place where all the state needs to be.

In the grand scheme of things this moves "logical" control over the
relay Client entirely into the ActiveRelayActor.

Some small side effects:

  • The ActiveRelayMessage::Ping and ActiveRelayMessage::GetLocalAddr
    messages are no longer needed. Though I decided to keep the latter
    for testing purposes.

  • ActiveRelayMessage::NotePreferred has been rename to SetHomeRelay.
    Since the ActiveRelayActor now reconnects to relays on its own it
    needs to keep track of whether it is the home relay itself as well.

  • The duplicate ping task tracking in the RelayActor is removed. This
    is still not ideal in the ActiveRelayActor because it still blocks
    this actor. But that's no regression and to be addressed when the
    relay Client is no longer an actor.

  • RelayActor::close_and_reconnect_relay and
    RelayActor::send_to_active_relay are no longer needed. Because we
    await all the ActiveRelayActor tasks already we do not need to
    manually track them in case they need to be closed.

  • The ClientBuilder was no longer using is_preferred, so remove this.

Breaking Changes

iroh-relay

  • ClientBuilder::is_preferred no longer exists. Set the preference once the client exists instead.

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

This moves the reconnection logic ingo ActiveRelayActor instead of
doing this in the RelayActor.  The logic itself is not really changed.
This does simplify things a fair bit though, it is a lot easier to do
this in one place where all the state needs to be.

In the grand scheme of things this moves "logical" control over the
relay Client entirely into the ActiveRelayActor.

Some small side effects:

- The ActiveRelayMessage::Ping and ActiveRelayMessage::GetLocalAddr
  messages are no longer needed.  Though I decided to keep the latter
  for testing purposes.

- ActiveRelayMessage::NotePreferred has been rename to SetHomeRelay.
  Since the ActiveRelayActor now reconnects to relays on its own it
  needs to keep track of whether it is the home relay itself as well.

- The duplicate ping task tracking in the RelayActor is removed.  This
  is still not ideal in the ActiveRelayActor because it still blocks
  this actor.  But that's no regression and to be addressed when the
  relay Client is no longer an actor.

- RelayActor::close_and_reconnect_relay and
  RelayActor::send_to_active_relay are no longer needed.  Because we
  await all the ActiveRelayActor tasks already we do not need to
  manually track them in case they need to be closed.

- The ClientBuilder was no longer using is_preferred, so remove this.
@flub flub requested a review from a team December 17, 2024 18:18
Copy link

github-actions bot commented Dec 17, 2024

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

Last updated: 2024-12-18T08:10:07Z

@flub flub changed the title refactor(iroh, iroh-relay): Do reconnection in ActiveRelayActor refactor(iroh, iroh-relay)!: Do reconnection in ActiveRelayActor Dec 17, 2024
Copy link

github-actions bot commented Dec 17, 2024

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: 71ad1b2

@flub flub requested a review from dignifiedquire December 17, 2024 19:45
@flub flub added this pull request to the merge queue Dec 18, 2024
Merged via the queue into main with commit 272b6c4 Dec 18, 2024
25 of 26 checks passed
@flub flub deleted the flub/relay-actor-reconnect branch May 14, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants