eth/downloader: mark peers idle when state sync is done

This commit is contained in:
Felix Lange 2017-05-30 14:52:08 +02:00 committed by Péter Szilágyi
parent ac085e02a2
commit 465acb2eec
No known key found for this signature in database
GPG key ID: E9AE538CEDF8293D

View file

@ -85,10 +85,12 @@ func (d *Downloader) runStateSync(s *stateSync) *stateSync {
finishedReqs []*stateReq
timeout = make(chan *stateReq)
)
// Cancel active request timers on exit.
defer func() {
// Cancel active request timers on exit. Also set peers to idle so they're
// available for the next sync.
for _, req := range activeReqs {
req.timer.Stop()
req.peer.SetNodeDataIdle(0)
}
}()
// Run the state sync.