Commit 632f3c5c authored by Aarsh Shah's avatar Aarsh Shah

better handling for disable bootstrap option

parent da6edafb
......@@ -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 {
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment