Multiaddr duplicated p2p protocol in relay reservation (#2696)#2701
Merged
mxinden merged 3 commits intolibp2p:masterfrom Jun 27, 2022
Merged
Conversation
f380909 to
a67aaf1
Compare
mxinden
reviewed
Jun 14, 2022
Member
mxinden
left a comment
There was a problem hiding this comment.
Thanks for tackling this.
Small suggestions. What do you think of the diff below?
diff --git a/protocols/relay/src/v2/relay.rs b/protocols/relay/src/v2/relay.rs
index 8d8bb75c..ed5fe6ca 100644
--- a/protocols/relay/src/v2/relay.rs
+++ b/protocols/relay/src/v2/relay.rs
@@ -756,9 +756,13 @@ impl Action {
inbound_reservation_req,
addrs: poll_parameters
.external_addresses()
- .map(|a| {
- a.addr
- .with(Protocol::P2p((*poll_parameters.local_peer_id()).into()))
+ .map(|a| a.addr)
+ // Add local peer ID in case it isn't present yet.
+ .filter_map(|a| match a.iter().last()? {
+ Protocol::P2p(_) => Some(a),
+ _ => Some(
+ a.with(Protocol::P2p(*poll_parameters.local_peer_id().as_ref())),
+ ),
})
.collect(),
}),Also, would you mind including a changelog entry and a libp2p-relay patch version bump?
- Minor fixes after review - Bump libp2p-relay Cargo.toml version to 0.9.2 - Add entry in Changelog for upcoming 0.9.2 version
a67aaf1 to
b3f3b59
Compare
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In protocols/relay/src/v2/relay.rs do not append P2p protocol if already present.
Now the built multiaddr does not contain a dupped P2p protocol. Logs are OK:
Open Questions
Change checklist