eth/downloader: fix cancel channel double close

pull/994/head
Péter Szilágyi 9 years ago
parent 7d71a75d77
commit 4f0d88cb02
  1. 9
      eth/downloader/downloader.go

@ -212,9 +212,14 @@ func (d *Downloader) Cancel() bool {
return false return false
} }
// Close the current cancel channel // Close the current cancel channel
d.cancelLock.RLock() d.cancelLock.Lock()
select {
case <-d.cancelCh:
// Channel was already closed
default:
close(d.cancelCh) close(d.cancelCh)
d.cancelLock.RUnlock() }
d.cancelLock.Unlock()
// reset the queue // reset the queue
d.queue.Reset() d.queue.Reset()

Loading…
Cancel
Save