Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions eth/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -630,15 +630,18 @@ func (d *Downloader) cancel() {
// Cancel aborts all of the operations and waits for all download goroutines to
// finish before returning.
func (d *Downloader) Cancel() {
d.blockchain.InterruptInsert(true)
d.cancel()
d.cancelWg.Wait()
d.blockchain.InterruptInsert(false)
}

// Terminate interrupts the downloader, canceling all pending operations.
// The downloader cannot be reused after calling Terminate.
func (d *Downloader) Terminate() {
// Terminates chain insertion, which may result in an "aborted" error in
// the blockchain and ultimately lead to the corresponding peer being
// disconnected. This is acceptable behavior during Geth shutdown.
d.blockchain.InterruptInsert(true)

// Close the termination channel (make sure double close is allowed)
d.quitLock.Lock()
select {
Expand Down