mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-16 11:31:22 +00:00
core: remove duplicates when performing address translation (#1697)
* core: remove duplicates when performing address translation * core: use filter_map instead of flat_map Co-authored-by: Roman Borschel <romanb@users.noreply.github.com> Co-authored-by: Roman Borschel <romanb@users.noreply.github.com>
This commit is contained in:
@ -205,7 +205,15 @@ where
|
||||
TMuxer: 'a,
|
||||
THandler: 'a,
|
||||
{
|
||||
self.listen_addrs().flat_map(move |server| address_translation(server, observed_addr))
|
||||
let mut addrs: Vec<_> = self.listen_addrs()
|
||||
.filter_map(move |server| address_translation(server, observed_addr))
|
||||
.collect();
|
||||
|
||||
// remove duplicates
|
||||
addrs.sort_unstable();
|
||||
addrs.dedup();
|
||||
|
||||
addrs.into_iter()
|
||||
}
|
||||
|
||||
/// Returns the peer id of the local node.
|
||||
|
Reference in New Issue
Block a user