Commit 9c0fe130 authored by Jeromy's avatar Jeromy

implement dht findprovs and add error output to dht query

parent 356dcff8
...@@ -67,7 +67,6 @@ func (dht *IpfsDHT) GetClosestPeers(ctx context.Context, key u.Key) (<-chan peer ...@@ -67,7 +67,6 @@ func (dht *IpfsDHT) GetClosestPeers(ctx context.Context, key u.Key) (<-chan peer
filtered = append(filtered, dht.peerstore.PeerInfo(clp)) filtered = append(filtered, dht.peerstore.PeerInfo(clp))
} }
} }
log.Errorf("filtered: %v", filtered)
// For DHT query command // For DHT query command
notif.PublishQueryEvent(ctx, &notif.QueryEvent{ notif.PublishQueryEvent(ctx, &notif.QueryEvent{
......
...@@ -3,6 +3,7 @@ package dht ...@@ -3,6 +3,7 @@ package dht
import ( import (
"sync" "sync"
notif "github.com/jbenet/go-ipfs/notifications"
peer "github.com/jbenet/go-ipfs/p2p/peer" peer "github.com/jbenet/go-ipfs/p2p/peer"
queue "github.com/jbenet/go-ipfs/p2p/peer/queue" queue "github.com/jbenet/go-ipfs/p2p/peer/queue"
"github.com/jbenet/go-ipfs/routing" "github.com/jbenet/go-ipfs/routing"
...@@ -230,6 +231,12 @@ func (r *dhtQueryRunner) queryPeer(cg ctxgroup.ContextGroup, p peer.ID) { ...@@ -230,6 +231,12 @@ func (r *dhtQueryRunner) queryPeer(cg ctxgroup.ContextGroup, p peer.ID) {
pi := peer.PeerInfo{ID: p} pi := peer.PeerInfo{ID: p}
if err := r.query.dht.host.Connect(cg.Context(), pi); err != nil { if err := r.query.dht.host.Connect(cg.Context(), pi); err != nil {
log.Debugf("Error connecting: %s", err) log.Debugf("Error connecting: %s", err)
notif.PublishQueryEvent(cg.Context(), &notif.QueryEvent{
Type: notif.QueryError,
Extra: err.Error(),
})
r.Lock() r.Lock()
r.errs = append(r.errs, err) r.errs = append(r.errs, err)
r.Unlock() r.Unlock()
......
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