Skip to content

fix(webrtc): allocate UDP ports and clean up failed listeners - #3630

Merged
tabcat merged 11 commits into
libp2p:mainfrom
peerbit-org:peerbit-org/webrtc-udp-listener-20260912
Oct 19, 2026
Merged

tabcat merged 11 commits into
libp2p:mainfrom
peerbit-org:peerbit-org/webrtc-udp-listener-20260912

Conversation

@peerbit-org

@peerbit-org peerbit-org commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Allocate WebRTC Direct's ephemeral ports using UDP instead of a TCP probe. Reselect only on native ephemeral-bind failure, bounded to five attempts; explicit-port failures still propagate. Remove the get-port dependency.

Unregister failed startups, record the actual allocated port, and allow close() to finish when startup fails.

Local validation: 17 listener/transport tests pass and exit naturally; all six new regressions fail against the original code. Firefox: 47 passing, 24 existing skips. Package-local typecheck and lint pass.

The full Node suite completes its assertions but retains the process on both baseline and fix; this is not counted as a clean lifecycle pass. Full CI remains required.

Includes #3629 and its #3628 build prerequisite; the UDP fix is a separate commit. #3627 tracks the pre-existing Floodsub browser exception.

@peerbit-org
peerbit-org requested a review from a team as a code owner September 12, 2026 21:38
@tabcat

tabcat commented Sep 13, 2026

Copy link
Copy Markdown
Member

i'd like to open some pulls upstream so ephemeral ports could be reserved there, as that would be the correct fix, but this is a good solution until then. will review soon

@peerbit-org

Copy link
Copy Markdown
Contributor Author

Fixed the Windows collision fixture in f25543d: bind the blocker to 127.0.0.1, matching the native listener. Windows can permit the previous wildcard/specific-address pair on one port (Winsock behavior). Also replaced the rejected spelling in the test name.

No production change, platform skip, timeout increase or test retry. All 17 focused tests pass locally with natural process exit; the failed-start regression still fails against original production. Package-local typecheck, lint and spellcheck pass. Fresh CI must confirm Windows.

…p-listener-20260912

Resolve to main's versions for the files changed by the protons pin commit, so this PR no longer changes them.
The native error is the same for every listen failure, so matching its message did not tell a collision from anything else.
@tabcat
tabcat merged commit 3da8bab into libp2p:main Oct 19, 2026
34 checks passed
@tabcat

tabcat commented Oct 19, 2026

Copy link
Copy Markdown
Member

@peerbit-org thanks!

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