mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-06-06 01:31:18 -04:00
Close ticker
This commit is contained in:
parent
d07e0e7fea
commit
0e58e069cb
2 changed files with 7 additions and 0 deletions
|
@ -82,6 +82,7 @@ func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressRep
|
||||||
if err != nil {
|
if err != nil {
|
||||||
file.Close()
|
file.Close()
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
|
writerProgress.Close()
|
||||||
if doRetries && attempt < maxRetries && !progressReporter.Cancelled() {
|
if doRetries && attempt < maxRetries && !progressReporter.Cancelled() {
|
||||||
time.Sleep(retryDelay)
|
time.Sleep(retryDelay)
|
||||||
continue
|
continue
|
||||||
|
@ -90,6 +91,7 @@ func downloadFileWithSemaphore(ctx context.Context, progressReporter ProgressRep
|
||||||
}
|
}
|
||||||
file.Close()
|
file.Close()
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
|
writerProgress.Close()
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,3 +33,8 @@ func (r *WriterProgress) Write(p []byte) (n int, err error) {
|
||||||
r.downloadToReport += int64(n)
|
r.downloadToReport += int64(n)
|
||||||
return n, err
|
return n, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *WriterProgress) Close() error {
|
||||||
|
r.updateProgressTicker.Stop()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue