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
f7353aac
Commit
f7353aac
authored
Aug 19, 2019
by
Aarsh Shah
Committed by
Steven Allen
Oct 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reset timer on bucket
parent
d53dfd6a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
dht.go
dht.go
+11
-7
dht_bootstrap.go
dht_bootstrap.go
+1
-1
No files found.
dht.go
View file @
f7353aac
...
...
@@ -21,18 +21,18 @@ import (
"github.com/libp2p/go-libp2p-kad-dht/metrics"
opts
"github.com/libp2p/go-libp2p-kad-dht/opts"
pb
"github.com/libp2p/go-libp2p-kad-dht/pb"
providers
"github.com/libp2p/go-libp2p-kad-dht/providers"
"github.com/libp2p/go-libp2p-kad-dht/providers"
proto
"github.com/gogo/protobuf/proto"
cid
"github.com/ipfs/go-cid"
"github.com/gogo/protobuf/proto"
"github.com/ipfs/go-cid"
ds
"github.com/ipfs/go-datastore"
logging
"github.com/ipfs/go-log"
goprocess
"github.com/jbenet/goprocess"
goprocessctx
"github.com/jbenet/goprocess/context"
"github.com/jbenet/goprocess"
"github.com/jbenet/goprocess/context"
kb
"github.com/libp2p/go-libp2p-kbucket"
record
"github.com/libp2p/go-libp2p-record"
"github.com/libp2p/go-libp2p-record"
recpb
"github.com/libp2p/go-libp2p-record/pb"
base32
"github.com/whyrusleeping/base32"
"github.com/whyrusleeping/base32"
)
var
logger
=
logging
.
Logger
(
"dht"
)
...
...
@@ -307,6 +307,10 @@ func (dht *IpfsDHT) findPeerSingle(ctx context.Context, p peer.ID, id peer.ID) (
resp
,
err
:=
dht
.
sendRequest
(
ctx
,
p
,
pmes
)
switch
err
{
case
nil
:
// reset the timer for the k-bucket we just searched in ONLY if there was no error
// so that we can retry during the next bootstrap
bucket
:=
dht
.
routingTable
.
BucketForPeer
(
id
)
bucket
.
ResetLastQueriedAt
(
time
.
Now
())
return
resp
,
nil
case
ErrReadTimeout
:
logger
.
Warningf
(
"read timeout: %s %s"
,
p
.
Pretty
(),
id
)
...
...
dht_bootstrap.go
View file @
f7353aac
...
...
@@ -75,7 +75,7 @@ func (dht *IpfsDHT) BootstrapWithConfig(ctx context.Context, cfg BootstrapConfig
for
{
err
:=
dht
.
BootstrapSelf
(
ctx
)
if
err
!=
nil
{
logger
.
Warningf
(
"error bootstrapping while
query
ing for self: %s"
,
err
)
logger
.
Warningf
(
"error bootstrapping while
search
ing for
my
self
(I'm Too Shallow ?)
: %s"
,
err
)
}
select
{
case
<-
time
.
After
(
cfg
.
SelfQueryInterval
)
:
...
...
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