Commit c070c2f0 authored by Jeromy's avatar Jeromy Committed by Juan Batiz-Benet

working on debugging dht issues

parent 2f345c85
......@@ -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
......
......@@ -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)
}
......
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