1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-02 03:28:25 +08:00

working on debugging dht issues

This commit is contained in:
Jeromy
2014-10-20 22:49:13 -07:00
committed by Juan Batiz-Benet
parent 2f345c8515
commit c070c2f0de
2 changed files with 7 additions and 4 deletions

View File

@ -272,7 +272,7 @@ func (dht *IpfsDHT) getValueOrPeers(ctx context.Context, p peer.Peer,
// Perhaps we were given closer peers
var peers []peer.Peer
for _, pb := range pmes.GetCloserPeers() {
pr, err := dht.addPeer(pb)
pr, err := dht.ensureConnectedToPeer(pb)
if err != nil {
log.Error("%s", err)
continue

View File

@ -48,10 +48,10 @@ func (dht *IpfsDHT) handleGetValue(p peer.Peer, pmes *Message) (*Message, error)
}
// let's first check if we have the value locally.
log.Debug("%s handleGetValue looking into ds\n", dht.self)
log.Debug("%s handleGetValue looking into ds", dht.self)
dskey := u.Key(pmes.GetKey()).DsKey()
iVal, err := dht.datastore.Get(dskey)
log.Debug("%s handleGetValue looking into ds GOT %v\n", dht.self, iVal)
log.Debug("%s handleGetValue looking into ds GOT %v", dht.self, iVal)
// if we got an unexpected error, bail.
if err != nil && err != ds.ErrNotFound {
@ -63,7 +63,7 @@ func (dht *IpfsDHT) handleGetValue(p peer.Peer, pmes *Message) (*Message, error)
// if we have the value, send it back
if err == nil {
log.Debug("%s handleGetValue success!\n", dht.self)
log.Debug("%s handleGetValue success!", dht.self)
byts, ok := iVal.([]byte)
if !ok {
@ -85,6 +85,9 @@ func (dht *IpfsDHT) handleGetValue(p peer.Peer, pmes *Message) (*Message, error)
if closer != nil {
for _, p := range closer {
log.Debug("handleGetValue returning closer peer: '%s'", p)
if len(p.Addresses()) < 1 {
log.Error("no addresses on peer being sent!")
}
}
resp.CloserPeers = peersToPBPeers(closer)
}