Skip to content
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

fix(relay/client): only try to forward handler events once #5765

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

elenaf9
Copy link
Contributor

@elenaf9 elenaf9 commented Dec 25, 2024

Description

We currently try to forward pending handler events in the relay client behavior twice: in handle_established_{in, out}bound_connection and in on_swarm_event() (introduced in #3328).
This is redundant because by the second time we try to forward it there won't be any pending event anymore.
This PR removes the duplicated logic from on_swarm_event. Forwarding it in handle_established_{in, out}bound_connection is more convenient as we still have direct access to the handler there and don't need to go through the swarm.

However, it requires that in handle_established_{in, out}bound_connection the event is also removed when the connection is relayed, in which case the event is simply discarded because the commands are only valid on direct connections.

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@elenaf9 elenaf9 changed the title fix(relay/client): only send handler commands on direct connections fix(relay/client): only try to forward handler events once Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants