Browse Source

replace repeate timer with simple ticker

no need for repeate timer here (no need for goroutine safety)
pull/456/head
Anton Kalyaev 8 years ago
committed by Anton Kaliaev
parent
commit
1a59b6a3b4
No known key found for this signature in database GPG Key ID: 7B6881D965918214
1 changed files with 3 additions and 4 deletions
  1. +3
    -4
      pex_reactor.go

+ 3
- 4
pex_reactor.go View File

@ -142,19 +142,18 @@ func (r *PEXReactor) ensurePeersRoutine() {
r.ensurePeers()
// fire periodically
timer := NewRepeatTimer("pex", r.ensurePeersPeriod)
ticker := time.NewTicker(r.ensurePeersPeriod)
FOR_LOOP:
for {
select {
case <-timer.Ch:
case <-ticker.C:
r.ensurePeers()
case <-r.Quit:
break FOR_LOOP
}
}
// Cleanup
timer.Stop()
ticker.Stop()
}
// ensurePeers ensures that sufficient peers are connected. (once)


Loading…
Cancel
Save