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: listen on circuit relay addresses that contain unsupported segments #1732

Merged
merged 4 commits into from
May 5, 2023

Conversation

achingbrain
Copy link
Member

@achingbrain achingbrain commented May 4, 2023

Fixes a bug whereby receiving a circuit relay address would cause js-libp2p to try to listen on the non-relayed parts of the address. For example if a relay listening on a WebTransport multiaddr was dialled, js-libp2p would then try to listen on the same address due to the relay reservation store calling transportManager.listen with the full address. This would then fail and the relaying would not succeed.

The fix is to call transportManager.listen with a multiaddr that just has the peer id and the p2p-circuit segments so only the relay transport tries to use the address.

For safety if listening on an address or writing to the peer store fails while creating a relay reservation, remove the reservation from the reservation store to allow us to try again.

Also updates logging to make what is going on a bit clearer.

Closes #1690

If listening on an address or writing to the peer store fails while
creating a relay reservation, remove the reservation from the
reservation store to allow us to try again.
@achingbrain achingbrain requested a review from maschad May 4, 2023 08:03
@achingbrain achingbrain changed the title fix: remove reservation if connection to relay fails fix: listen on circuit relay addresses that contain unsupported segments May 4, 2023
@achingbrain achingbrain merged commit 947639f into master May 5, 2023
@achingbrain achingbrain deleted the fix/circuit-relay-reconnections branch May 5, 2023 06:21
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.

Unexpected behaviour when a circuit relay server is also relayed
3 participants