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
632f3c5c
Commit
632f3c5c
authored
Nov 03, 2019
by
Aarsh Shah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better handling for disable bootstrap option
parent
da6edafb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
3 deletions
+7
-3
dht_bootstrap.go
dht_bootstrap.go
+4
-2
opts/options.go
opts/options.go
+3
-1
No files found.
dht_bootstrap.go
View file @
632f3c5c
...
...
@@ -66,6 +66,9 @@ func (dht *IpfsDHT) startBootstrapping() error {
if
err
:=
dht
.
doBootstrap
(
ctx
,
true
);
err
!=
nil
{
logger
.
Warningf
(
"bootstrap error: %s"
,
err
)
}
}
else
{
// disable the "auto-bootstrap" ticker so that no more ticks are sent to his channel
scanInterval
.
Stop
()
}
for
{
...
...
@@ -96,9 +99,8 @@ func (dht *IpfsDHT) doBootstrap(ctx context.Context, walkSelf bool) error {
if
walkSelf
{
if
err
:=
dht
.
selfWalk
(
ctx
);
err
!=
nil
{
return
fmt
.
Errorf
(
"self walk: error: %s"
,
err
)
}
else
{
dht
.
latestSelfWalk
=
time
.
Now
()
}
dht
.
latestSelfWalk
=
time
.
Now
()
}
if
err
:=
dht
.
bootstrapBuckets
(
ctx
);
err
!=
nil
{
...
...
opts/options.go
View file @
632f3c5c
...
...
@@ -149,7 +149,9 @@ func BucketSize(bucketSize int) Option {
}
}
// DisableAutoBootstrap disables auto bootstrap on the dht
// DisableAutoBootstrap completely disables 'auto-bootstrap' on the Dht
// This means that neither will we do periodic bootstrap nor will we
// bootstrap the Dht even if the Routing Table size goes below the minimum threshold
func
DisableAutoBootstrap
()
Option
{
return
func
(
o
*
Options
)
error
{
o
.
TriggerAutoBootstrap
=
false
...
...
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