(skipCancelContext bool)
| 501 | } |
| 502 | |
| 503 | func (d *Downloader) Stop(skipCancelContext bool) { |
| 504 | if !d.running { |
| 505 | return |
| 506 | } |
| 507 | |
| 508 | // Stop new and current requests |
| 509 | if !skipCancelContext { |
| 510 | d.cancel() |
| 511 | } |
| 512 | d.newRequestWg.Wait() |
| 513 | close(d.reqch) |
| 514 | |
| 515 | // Let workers try to trigger exit first |
| 516 | d.workerWg.Wait() |
| 517 | close(d.respch) |
| 518 | |
| 519 | // Wait for all responses to finish processing |
| 520 | d.responderWg.Wait() |
| 521 | close(d.updatech) |
| 522 | d.updaterWg.Wait() |
| 523 | |
| 524 | d.running = false |
| 525 | _ = d.state.runningLabel.Set("Stopped") |
| 526 | } |
| 527 | |
| 528 | func (d *Downloader) NewRequest(f *IndexedFile) (*grab.Request, error) { |
| 529 | // Set up request |
no outgoing calls
no test coverage detected