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): send correct PeerId to client in outbound STOP message #3767

Merged
merged 7 commits into from
Apr 11, 2023

Conversation

thomaseizinger
Copy link
Contributor

Description

Previously, the relay server would erroneously send its own PeerId in the STOP message to the client upon an incoming relay connection. This is obviously wrong and results in failed connection upgrades in other implementations.

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

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Thanks @thomaseizinger for the patch.

Thanks @MarcoPolo @p-shahi and @maschad for catching it!

@mxinden
Copy link
Member

mxinden commented Apr 11, 2023

For the record, properly documented in the specification:

the peer field contains a Peer struct with the peer ID of the connection initiator.

https://github.com/libp2p/specs/blob/master/relay/circuit-v2.md#stop-protocol

@mergify

This comment was marked as resolved.

@mergify mergify bot merged commit af63130 into master Apr 11, 2023
@mergify mergify bot deleted the fix/relay-correct-peer-id branch April 11, 2023 22:11
mergify bot pushed a commit that referenced this pull request Apr 12, 2023
With the changes from #3767, we made the `connect` test flaky because the `Swarm` was fully passed to the future and thus dropped as soon as the connection was established. We pass a mutable reference instead which keeps the `Swarm` alive.

Pull-Request: #3780.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants