Fix duplicate external addresses inserted (#927)

This commit is contained in:
Pierre Krieger
2019-02-07 13:46:39 +01:00
committed by GitHub
parent 5cac5b5573
commit 63db253566
2 changed files with 4 additions and 2 deletions

View File

@ -2,7 +2,7 @@
name = "libp2p-core"
edition = "2018"
description = "Core traits and structs of libp2p"
version = "0.3.3"
version = "0.3.4"
authors = ["Parity Technologies <admin@parity.io>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"

View File

@ -315,7 +315,9 @@ where TBehaviour: NetworkBehaviour,
},
Async::Ready(NetworkBehaviourAction::ReportObservedAddr { address }) => {
for addr in self.raw_swarm.nat_traversal(&address) {
self.external_addrs.push(addr);
if self.external_addrs.iter().all(|a| *a != addr) {
self.external_addrs.push(addr);
}
}
},
}