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
dms3
go-dms3-routing
Commits
3cfc215b
Commit
3cfc215b
authored
Nov 19, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send record fixes to peers who send outdated records
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
f1397e31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
dht/dht.go
dht/dht.go
+3
-1
dht/routing.go
dht/routing.go
+11
-1
No files found.
dht/dht.go
View file @
3cfc215b
...
...
@@ -173,7 +173,9 @@ func (dht *IpfsDHT) getValueOrPeers(ctx context.Context, p peer.ID,
err
=
dht
.
verifyRecordOnline
(
ctx
,
record
)
if
err
!=
nil
{
log
.
Info
(
"Received invalid record! (discarded)"
)
return
nil
,
nil
,
err
// still return a non-nil record to signify that we received
// a bad record from this peer
record
=
new
(
pb
.
Record
)
}
return
record
,
peers
,
nil
}
...
...
dht/routing.go
View file @
3cfc215b
...
...
@@ -91,7 +91,9 @@ func (dht *IpfsDHT) GetValue(ctx context.Context, key key.Key) ([]byte, error) {
var
recs
[][]
byte
for
_
,
v
:=
range
vals
{
recs
=
append
(
recs
,
v
.
Val
)
if
v
.
Val
!=
nil
{
recs
=
append
(
recs
,
v
.
Val
)
}
}
i
,
err
:=
dht
.
Selector
.
BestRecord
(
key
,
recs
)
...
...
@@ -170,6 +172,14 @@ func (dht *IpfsDHT) GetValues(ctx context.Context, key key.Key, nvals int) ([]ro
rec
,
peers
,
err
:=
dht
.
getValueOrPeers
(
ctx
,
p
,
key
)
if
err
!=
nil
{
if
err
==
routing
.
ErrNotFound
{
// in this case, they responded with nothing,
// still send a notification
notif
.
PublishQueryEvent
(
parent
,
&
notif
.
QueryEvent
{
Type
:
notif
.
PeerResponse
,
ID
:
p
,
})
}
return
nil
,
err
}
...
...
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