@@ -150,15 +150,15 @@ func (dht *IpfsDHT) putValueToPeer(ctx context.Context, p peer.ID,
150150 pmes .Record = rec
151151 rpmes , err := dht .sendRequest (ctx , p , pmes )
152152 if err != nil {
153- if err == ErrReadTimeout {
154- log .Warningf ("read timeout: %s %s" , p .Pretty (), key )
155- }
153+ log .Debugf ("putValueToPeer: %v. (peer: %s, key: %s)" , err , p .Pretty (), key )
156154 return err
157155 }
158156
159157 if ! bytes .Equal (rpmes .GetRecord ().Value , pmes .GetRecord ().Value ) {
158+ log .Warningf ("putValueToPeer: value not put correctly. (%v != %v)" , pmes , rpmes )
160159 return errors .New ("value not put correctly" )
161160 }
161+
162162 return nil
163163}
164164
@@ -218,7 +218,7 @@ func (dht *IpfsDHT) getValueSingle(ctx context.Context, p peer.ID, key string) (
218218 case nil :
219219 return resp , nil
220220 case ErrReadTimeout :
221- log .Warningf ("read timeout: %s %s" , p .Pretty (), key )
221+ log .Warningf ("getValueSingle: read timeout %s %s" , p .Pretty (), key )
222222 fallthrough
223223 default :
224224 eip .SetError (err )
@@ -231,12 +231,13 @@ func (dht *IpfsDHT) getLocal(key string) (*recpb.Record, error) {
231231 log .Debugf ("getLocal %s" , key )
232232 rec , err := dht .getRecordFromDatastore (mkDsKey (key ))
233233 if err != nil {
234+ log .Warningf ("getLocal: %s" , err )
234235 return nil , err
235236 }
236237
237238 // Double check the key. Can't hurt.
238239 if rec != nil && rec .GetKey () != key {
239- log .Errorf ("BUG: found a DHT record that didn't match it's key: %s != %s" , rec .GetKey (), key )
240+ log .Errorf ("BUG getLocal : found a DHT record that didn't match it's key: %s != %s" , rec .GetKey (), key )
240241 return nil , nil
241242
242243 }
@@ -256,8 +257,10 @@ func (dht *IpfsDHT) getOwnPrivateKey() (ci.PrivKey, error) {
256257
257258// putLocal stores the key value pair in the datastore
258259func (dht * IpfsDHT ) putLocal (key string , rec * recpb.Record ) error {
260+ log .Debugf ("putLocal: %v %v" , key , rec )
259261 data , err := proto .Marshal (rec )
260262 if err != nil {
263+ log .Warningf ("putLocal: %s" , err )
261264 return err
262265 }
263266
@@ -334,7 +337,7 @@ func (dht *IpfsDHT) betterPeersToQuery(pmes *pb.Message, p peer.ID, count int) [
334337
335338 // no node? nil
336339 if closer == nil {
337- log .Warning ("no closer peers to send:" , p )
340+ log .Warning ("betterPeersToQuery: no closer peers to send:" , p )
338341 return nil
339342 }
340343
@@ -343,7 +346,7 @@ func (dht *IpfsDHT) betterPeersToQuery(pmes *pb.Message, p peer.ID, count int) [
343346
344347 // == to self? thats bad
345348 if clp == dht .self {
346- log .Warning ( " attempted to return self! this shouldn't happen..." )
349+ log .Error ( "BUG betterPeersToQuery: attempted to return self! this shouldn't happen..." )
347350 return nil
348351 }
349352 // Dont send a peer back themselves
0 commit comments