Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-kad-dht
Commits
277f2537
Commit
277f2537
authored
Jun 13, 2018
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix getLocal error handling
parent
95067a1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
1 deletion
+3
-1
dht.go
dht.go
+1
-1
handlers.go
handlers.go
+2
-0
No files found.
dht.go
View file @
277f2537
...
...
@@ -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
...
...
handlers.go
View file @
277f2537
...
...
@@ -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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment