1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 09:52:20 +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

@ -236,9 +236,9 @@ func (dht *IpfsDHT) handleAddProvider(ctx context.Context, p peer.ID, pmes *pb.M
}
log.Infof("received provider %s for %s (addrs: %s)", p, key, pi.Addrs)
for _, maddr := range pi.Addrs {
if pi.ID != dht.self { // dont add own addrs.
// add the received addresses to our peerstore.
dht.peerstore.AddAddress(p, maddr)
dht.peerstore.AddPeerInfo(pi)
}
dht.providers.AddProvider(key, p)
}