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
  • Loading branch information
stormshield-pj50 committed Jun 10, 2022
1 parent 0d3787e commit a67aaf1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions protocols/relay/src/v2/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,12 @@ impl Action {
addrs: poll_parameters
.external_addresses()
.map(|a| {
a.addr
.with(Protocol::P2p((*poll_parameters.local_peer_id()).into()))
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),
}
})
.collect(),
}),
Expand Down

0 comments on commit a67aaf1

Please sign in to comment.