Skip to content

Commit

Permalink
periodicBootstrapInterval should be ticker? (ipfs#678)
Browse files Browse the repository at this point in the history
* fix: fixLowPeers now runs periodically

Co-authored-by: 刘林欣 <llx@ipfsmain.cn>
  • Loading branch information
TerenceClark and 刘林欣 authored Jul 16, 2020
1 parent 330b9be commit 81b0285
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,13 +375,13 @@ func (dht *IpfsDHT) Mode() ModeOpt {

// fixLowPeersRoutine tries to get more peers into the routing table if we're below the threshold
func (dht *IpfsDHT) fixLowPeersRoutine(proc goprocess.Process) {
timer := time.NewTimer(periodicBootstrapInterval)
defer timer.Stop()
ticker := time.NewTicker(periodicBootstrapInterval)
defer ticker.Stop()

for {
select {
case <-dht.fixLowPeersChan:
case <-timer.C:
case <-ticker.C:
case <-proc.Closing():
return
}
Expand Down

0 comments on commit 81b0285

Please sign in to comment.