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
78082710
Commit
78082710
authored
Mar 12, 2018
by
Dirk McCormick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that records published by this peer do not immediately expire
parent
bdf2cdc9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
routing.go
routing.go
+6
-0
No files found.
routing.go
View file @
78082710
...
...
@@ -8,7 +8,9 @@ import (
"sync"
"time"
proto
"github.com/gogo/protobuf/proto"
cid
"github.com/ipfs/go-cid"
u
"github.com/ipfs/go-ipfs-util"
logging
"github.com/ipfs/go-log"
pb
"github.com/libp2p/go-libp2p-kad-dht/pb"
kb
"github.com/libp2p/go-libp2p-kbucket"
...
...
@@ -45,6 +47,7 @@ func (dht *IpfsDHT) PutValue(ctx context.Context, key string, value []byte) (err
log
.
Debugf
(
"PutValue %s"
,
key
)
rec
:=
record
.
MakePutRecord
(
key
,
value
)
rec
.
TimeReceived
=
proto
.
String
(
u
.
FormatRFC3339
(
time
.
Now
()))
err
=
dht
.
putLocal
(
key
,
rec
)
if
err
!=
nil
{
return
err
...
...
@@ -101,6 +104,9 @@ func (dht *IpfsDHT) GetValue(ctx context.Context, key string) (_ []byte, err err
recs
=
append
(
recs
,
v
.
Val
)
}
}
if
len
(
recs
)
==
0
{
return
nil
,
routing
.
ErrNotFound
}
i
,
err
:=
dht
.
Selector
.
BestRecord
(
key
,
recs
)
if
err
!=
nil
{
...
...
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