Skip to content

feat: add listen and unlisten to libp2p - #3679

Open
zexoverz wants to merge 7 commits into
libp2p:mainfrom
zexoverz:feat/listen-unlisten
Open

zexoverz wants to merge 7 commits into
libp2p:mainfrom
zexoverz:feat/listen-unlisten

Conversation

@zexoverz

Copy link
Copy Markdown

Description

Adds libp2p.listen(addrs) and libp2p.unlisten(addrs) so a node can start listening after start(), e.g. on <relay>/p2p-circuit once an app handshake with the relay is done. listen forwards to the transport manager. unlisten closes listeners whose requested or current address matches, so passing the same address you gave to listen works even for /tcp/0.

Closes #3645

Notes & open questions

Getting a relay reservation again after the relay drops is unlisten then listen. Happy to rename or move this if you'd rather it lived elsewhere.

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

@zexoverz
zexoverz requested a review from a team as a code owner October 20, 2026 17:07
@zexoverz

Copy link
Copy Markdown
Author

Could someone approve the workflow runs? They're at action_required, so CI hasn't run yet.

This branch has not been deployed

No deployments
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.

Public API to listen on an address after start() (relay reservation gated by an application handshake)

1 participant