Commit a7eb52a7 authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

dht: helpful debugging for no closer peers

parent 64a4abcd
...@@ -258,12 +258,15 @@ func (r *dhtQueryRunner) queryPeer(p peer.ID) { ...@@ -258,12 +258,15 @@ func (r *dhtQueryRunner) queryPeer(p peer.ID) {
r.Unlock() r.Unlock()
r.cancel() // signal to everyone that we're done. r.cancel() // signal to everyone that we're done.
} else if res.closerPeers != nil { } else if len(res.closerPeers) > 0 {
log.Debugf("PEERS CLOSER -- worker for: %v", p) log.Debugf("PEERS CLOSER -- worker for: %v (%d closer peers)", p, len(res.closerPeers))
for _, next := range res.closerPeers { for _, next := range res.closerPeers {
// add their addresses to the dialer's peerstore // add their addresses to the dialer's peerstore
r.query.dialer.Peerstore().AddAddresses(next.ID, next.Addrs) r.query.dialer.Peerstore().AddAddresses(next.ID, next.Addrs)
r.addPeerToQuery(next.ID, p) r.addPeerToQuery(next.ID, p)
log.Debugf("PEERS CLOSER -- worker for: %v added %v (%v)", p, next.ID, next.Addrs)
} }
} else {
log.Debugf("QUERY worker for: %v - not found, and no closer peers.", p)
} }
} }
...@@ -139,6 +139,7 @@ func (dht *IpfsDHT) FindProvidersAsync(ctx context.Context, key u.Key, count int ...@@ -139,6 +139,7 @@ func (dht *IpfsDHT) FindProvidersAsync(ctx context.Context, key u.Key, count int
func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key u.Key, count int, peerOut chan peer.PeerInfo) { func (dht *IpfsDHT) findProvidersAsyncRoutine(ctx context.Context, key u.Key, count int, peerOut chan peer.PeerInfo) {
defer close(peerOut) defer close(peerOut)
log.Debugf("%s FindProviders %s", dht.self, key)
ps := pset.NewLimited(count) ps := pset.NewLimited(count)
provs := dht.providers.GetProviders(ctx, key) provs := dht.providers.GetProviders(ctx, key)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment