Skip to content

Commit

Permalink
Multiaddr duplicated p2p protocol in relay reservation (libp2p#2696)
Browse files Browse the repository at this point in the history
- Minor fixes after review
- Bump libp2p-relay Cargo.toml version to 0.9.2
- Add entry in Changelog for upcoming 0.9.2 version
  • Loading branch information
stormshield-pj50 committed Jun 15, 2022
1 parent 225b01f commit b3f3b59
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions protocols/relay/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 0.9.2 - unreleased

- Do not duplicate the p2p/xxx component with the relay PeerId when a client requests a reservation. See [PR 2701].

[PR 2701]: https://github.com/libp2p/rust-libp2p/pull/2701/

# 0.9.1

- Respond to at most one incoming reservation request. Deny <= 8 incoming
Expand Down
2 changes: 1 addition & 1 deletion protocols/relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-relay"
edition = "2021"
rust-version = "1.56.1"
description = "Communications relaying for libp2p"
version = "0.9.1"
version = "0.9.2"
authors = ["Parity Technologies <admin@parity.io>", "Max Inden <mail@max-inden.de>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
14 changes: 7 additions & 7 deletions protocols/relay/src/v2/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -756,13 +756,13 @@ impl Action {
inbound_reservation_req,
addrs: poll_parameters
.external_addresses()
.map(|a| {
let p2p_proto =
Protocol::P2p(*poll_parameters.local_peer_id().as_ref());
match a.addr.iter().last() {
Some(p) if p == p2p_proto => a.addr,
_ => a.addr.with(p2p_proto),
}
.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(),
}),
Expand Down

0 comments on commit b3f3b59

Please sign in to comment.