Commit 4f0d88cb authored by Péter Szilágyi's avatar Péter Szilágyi

eth/downloader: fix cancel channel double close

parent 7d71a75d
......@@ -212,9 +212,14 @@ func (d *Downloader) Cancel() bool {
return false
}
// Close the current cancel channel
d.cancelLock.RLock()
close(d.cancelCh)
d.cancelLock.RUnlock()
d.cancelLock.Lock()
select {
case <-d.cancelCh:
// Channel was already closed
default:
close(d.cancelCh)
}
d.cancelLock.Unlock()
// reset the queue
d.queue.Reset()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment