1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 14:34:24 +08:00

addr-explosion mitigated adding

mitigated adding our own addresses where received
from peers

see #573
This commit is contained in:
Juan Batiz-Benet
2015-01-16 02:13:00 -08:00
parent f78d4141a1
commit c057cea649
4 changed files with 14 additions and 5 deletions

View File

@ -223,8 +223,10 @@ func (dht *IpfsDHT) closerPeersSingle(ctx context.Context, key u.Key, p peer.ID)
var out []peer.ID
for _, pbp := range pmes.GetCloserPeers() {
pid := peer.ID(pbp.GetId())
dht.peerstore.AddAddresses(pid, pbp.Addresses())
out = append(out, pid)
if pid != dht.self { // dont add self
dht.peerstore.AddAddresses(pid, pbp.Addresses())
out = append(out, pid)
}
}
return out, nil
}