Skip to content

Commit

Permalink
protocols/relay: Don't duplicate p2p protocol in relay reservation (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
stormshield-pj50 committed Jun 27, 2022
1 parent 40744be commit f814b21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions protocols/relay/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

- Update to `libp2p-swarm` `v0.37.0`.

- 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
10 changes: 7 additions & 3 deletions protocols/relay/src/v2/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}),
Expand Down

0 comments on commit f814b21

Please sign in to comment.