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: only check for non-wildcard ports #3050

Merged
merged 1 commit into from
Mar 18, 2025
Merged

Conversation

achingbrain
Copy link
Member

If we are passed a wildcard port, start a UDP mux listener on a ephemeral port, otherwise check the existing listeners before trying to start a new one.

To be reused an existing listener must be owned by the current peer and be of the other IP family (e.g. you cannot listen on [ip4-host]:1234 twice but you can listen on [ip4-host:1234] and [ip6-host]:1234.

Fixes #3049

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

If we are passed a wildcard port, start a UDP mux listener on a
ephemeral port, otherwise check the existing listeners before trying
to start a new one.

To be reused an existing listener must be owned by the current peer
and be of the other IP family (e.g. you cannot listen on
`[ip4-host]:1234` twice but you can listen on `[ip4-host:1234]` and
`[ip6-host]:1234`.

Fixes #3049
@achingbrain achingbrain requested a review from a team as a code owner March 17, 2025 16:42
Copy link
Contributor

@2color 2color left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the quick fix.

@achingbrain achingbrain merged commit a71c7c3 into main Mar 18, 2025
44 of 47 checks passed
@achingbrain achingbrain deleted the fix/handle-peers-and-ports branch March 18, 2025 13:51
@achingbrain achingbrain mentioned this pull request Mar 18, 2025
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.

Error when two js-libp2p nodes on the same machine listen on '/ip4/0.0.0.0/udp/0/webrtc-direct'
2 participants