diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-21 07:46:24 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-21 07:46:24 (GMT) |
commit | 87e91b6487644ab9de12d0cb031b90cc599062e1 (patch) | |
tree | dc37e3eeb2ef957cfb575bb2c6a707d7d55b31fa /src/helsinki.at/rhimport/fetcher.go | |
parent | a71ce473ac19e8ba5cf69f0d1375807529d92b11 (diff) |
added a cancel channel to fetcher/importer (untestedgit show)
Diffstat (limited to 'src/helsinki.at/rhimport/fetcher.go')
-rw-r--r-- | src/helsinki.at/rhimport/fetcher.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/helsinki.at/rhimport/fetcher.go b/src/helsinki.at/rhimport/fetcher.go index a8ac22c..bff62bc 100644 --- a/src/helsinki.at/rhimport/fetcher.go +++ b/src/helsinki.at/rhimport/fetcher.go @@ -113,6 +113,10 @@ func FetchFileCurl(ctx *ImportContext, res *FetchResult, uri *url.URL) (err erro easy.Setopt(curl.OPT_NOPROGRESS, false) easy.Setopt(curl.OPT_PROGRESSFUNCTION, func(dltotal, dlnow, ultotal, ulnow float64, userdata interface{}) bool { + if ctx.Cancel != nil && len(ctx.Cancel) > 0 { + return false + } + ctx := userdata.(*ImportContext) if ctx.ProgressCallBack != nil { ctx.ProgressCallBack(1, "downloading", dlnow/dltotal, ctx.ProgressCallBackData) |