Skip to content

Commit

Permalink
Merge pull request ipfs#170 from libp2p/bug/bootstrap_immediately
Browse files Browse the repository at this point in the history
Bootstrap immediately after calls to BootstrapWithConfig
  • Loading branch information
Stebalien authored Jul 24, 2018
2 parents bb96b20 + 9d8818b commit d4e1e7e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dht_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,17 @@ func (dht *IpfsDHT) BootstrapWithConfig(cfg BootstrapConfig) (goprocess.Process,
return nil, fmt.Errorf("invalid number of queries: %d", cfg.Queries)
}

proc := periodicproc.Tick(cfg.Period, dht.bootstrapWorker(cfg))
proc := dht.Process().Go(func(p goprocess.Process) {
<-p.Go(dht.bootstrapWorker(cfg)).Closed()
for {
select {
case <-time.After(cfg.Period):
<-p.Go(dht.bootstrapWorker(cfg)).Closed()
case <-p.Closing():
return
}
}
})

return proc, nil
}
Expand Down

0 comments on commit d4e1e7e

Please sign in to comment.