mirror of
https://github.com/fluencelabs/go-libp2p-kad-dht
synced 2025-04-24 22:32:13 +00:00
fix getLocal error handling
This commit is contained in:
parent
95067a1cc4
commit
277f253733
2
dht.go
2
dht.go
@ -236,7 +236,7 @@ func (dht *IpfsDHT) getLocal(key string) (*recpb.Record, error) {
|
||||
// Double check the key. Can't hurt.
|
||||
if rec != nil && rec.GetKey() != key {
|
||||
log.Errorf("BUG: found a DHT record that didn't match it's key: %s != %s", rec.GetKey(), key)
|
||||
return nil, routing.ErrNotFound
|
||||
return nil, nil
|
||||
|
||||
}
|
||||
return rec, nil
|
||||
|
@ -217,6 +217,8 @@ func (dht *IpfsDHT) handlePutValue(ctx context.Context, p peer.ID, pmes *pb.Mess
|
||||
return pmes, err
|
||||
}
|
||||
|
||||
// returns nil, nil when either nothing is found or the value found doesn't properly validate.
|
||||
// returns nil, some_error when there's a *datastore* error (i.e., something goes very wrong)
|
||||
func (dht *IpfsDHT) getRecordFromDatastore(dskey ds.Key) (*recpb.Record, error) {
|
||||
reci, err := dht.datastore.Get(dskey)
|
||||
if err == ds.ErrNotFound {
|
||||
|
Loading…
x
Reference in New Issue
Block a user