Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Fix goroutine leak bug in DoDownloadTimeout #1565

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 6 additions & 1 deletion dfget/core/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ func DoDownloadTimeout(downloader Downloader, timeout time.Duration) error {

var ch = make(chan error)
go func() {
ch <- downloader.Run(ctx)
select {
case <- ctx.Done():
return
case ch <- downloader.Run(ctx):
return
}
}()
defer cancel()

Expand Down