summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport/fetcher.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimport/fetcher.go')
-rw-r--r--src/helsinki.at/rhimport/fetcher.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/helsinki.at/rhimport/fetcher.go b/src/helsinki.at/rhimport/fetcher.go
index 24635d1..1f0b364 100644
--- a/src/helsinki.at/rhimport/fetcher.go
+++ b/src/helsinki.at/rhimport/fetcher.go
@@ -116,6 +116,7 @@ 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 {
+ rhl.Printf("downloading '%s' got canceled", ctx.SourceUri)
res.ResponseCode = http.StatusNoContent
res.ErrorString = "canceled"
return false
@@ -129,6 +130,11 @@ func FetchFileCurl(ctx *ImportContext, res *FetchResult, uri *url.URL) (err erro
easy.Setopt(curl.OPT_PROGRESSDATA, ctx)
if err = easy.Perform(); err != nil {
+ if cbdata.File != nil {
+ rhdl.Printf("Removing stale file: %s", cbdata.filename)
+ os.Remove(cbdata.filename)
+ os.Remove(path.Dir(cbdata.filename))
+ }
if res.ResponseCode == http.StatusNoContent {
err = nil
} else {
@@ -176,6 +182,7 @@ func FetchFileFake(ctx *ImportContext, res *FetchResult, uri *url.URL) error {
} else {
for i := uint(0); i < uint(duration); i++ {
if ctx.Cancel != nil && len(ctx.Cancel) > 0 {
+ rhl.Printf("faking got canceled")
res.ResponseCode = http.StatusNoContent
res.ErrorString = "canceled"
return nil