protocols/relay: Don't duplicate p2p protocol in relay reservation (#2696) (#2701)

This commit is contained in:
pj50 2022-06-27 06:54:40 +02:00 committed by GitHub
parent 40744beec1
commit f814b21f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 3 deletions

View File

@ -4,6 +4,10 @@
- Update to `libp2p-swarm` `v0.37.0`. - 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 # 0.9.1
- Respond to at most one incoming reservation request. Deny <= 8 incoming - Respond to at most one incoming reservation request. Deny <= 8 incoming

View File

@ -756,9 +756,13 @@ impl Action {
inbound_reservation_req, inbound_reservation_req,
addrs: poll_parameters addrs: poll_parameters
.external_addresses() .external_addresses()
.map(|a| { .map(|a| a.addr)
a.addr // Add local peer ID in case it isn't present yet.
.with(Protocol::P2p((*poll_parameters.local_peer_id()).into())) .filter_map(|a| match a.iter().last()? {
Protocol::P2p(_) => Some(a),
_ => Some(
a.with(Protocol::P2p(*poll_parameters.local_peer_id().as_ref())),
),
}) })
.collect(), .collect(),
}), }),