File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed
Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -557,6 +557,8 @@ func (d *Downloader) spawnSync(fetchers []func() error) error {
557557func (d * Downloader ) cancel () {
558558 // Close the current cancel channel
559559 d .cancelLock .Lock ()
560+ defer d .cancelLock .Unlock ()
561+
560562 if d .cancelCh != nil {
561563 select {
562564 case <- d .cancelCh :
@@ -565,7 +567,6 @@ func (d *Downloader) cancel() {
565567 close (d .cancelCh )
566568 }
567569 }
568- d .cancelLock .Unlock ()
569570}
570571
571572// Cancel aborts all of the operations and waits for all download goroutines to
Original file line number Diff line number Diff line change @@ -222,7 +222,7 @@ func (cs *chainSyncer) loop() {
222222
223223 case <- cs .pm .quitSync :
224224 if cs .doneCh != nil {
225- cs .pm .downloader .Cancel ()
225+ cs .pm .downloader .Terminate () // Double term is fine, Cancel would block until queue is emptied
226226 <- cs .doneCh
227227 }
228228 return
You can’t perform that action at this time.
0 commit comments