func (r *PEXReactor) ensurePeersRoutine() {
	// Randomize when routine starts
	ensurePeersPeriodMs := r.ensurePeersPeriod.Nanoseconds() / 1e6
	time.Sleep(time.Duration(rand.Int63n(ensurePeersPeriodMs)) * time.Millisecond)

	// fire once immediately.
	r.ensurePeers()

	// fire periodically
	ticker := time.NewTicker(r.ensurePeersPeriod)

	for {
		select {
		case <-ticker.C:
			r.ensurePeers()
		case <-r.Quit:
			ticker.Stop()
			return
		}
	}
}
func (r *PEXReactor) ensurePeersRoutine() {
	
	ensurePeersPeriodMs := r.ensurePeersPeriod.Nanoseconds() / 1e6
	time.Sleep(time.Duration(rand.Int63n(ensurePeersPeriodMs)) * time.Millisecond)

	
	r.ensurePeers()

	
	ticker := time.NewTicker(r.ensurePeersPeriod)

	for {
		select {
		case <-ticker.C:
			r.ensurePeers()
		case <-r.Quit:
			ticker.Stop()
			return
		}
	}
}
func ( r * PEXReactor ) ensurePeersRoutine ( ) { // Randomize when routine starts ensurePeersPeriodMs := r . ensurePeersPeriod . Nanoseconds ( ) / 1e6 time . Sleep ( time . Duration ( rand . Int63n ( ensurePeersPeriodMs ) ) * time . Millisecond ) // fire once immediately. r . ensurePeers ( ) // fire periodically ticker := time . NewTicker ( r . ensurePeersPeriod ) for { select { case <- ticker . C : r . ensurePeers ( ) case <- r . Quit : ticker . Stop ( ) return } } }
// Ensures that sufficient peers are connected. (continuous)
Ensures that sufficient peers are connected . ( continuous )