summaryrefslogtreecommitdiff
path: root/rhimport
diff options
context:
space:
mode:
Diffstat (limited to 'rhimport')
-rw-r--r--rhimport/fetcher.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/rhimport/fetcher.go b/rhimport/fetcher.go
index 45d2e7b..1cc6439 100644
--- a/rhimport/fetcher.go
+++ b/rhimport/fetcher.go
@@ -49,6 +49,7 @@ type FetcherCurlCBData struct {
filename string
remotename string
conv FetchConverter
+ totalSize float64
written uint64
writeError error
}
@@ -99,6 +100,12 @@ func curlWriteCallback(ptr []byte, userdata interface{}) bool {
return false
}
+ if data.ctx.ProgressCallBack != nil {
+ if keep := data.ctx.ProgressCallBack(1, "downloading", float64(data.written), data.totalSize, data.ctx.ProgressCallBackData); !keep {
+ data.ctx.ProgressCallBack = nil
+ }
+ }
+
return true
}
@@ -121,11 +128,7 @@ func curlProgressCallback(dltotal, dlnow, ultotal, ulnow float64, userdata inter
return false
}
- if data.ctx.ProgressCallBack != nil {
- if keep := data.ctx.ProgressCallBack(1, "downloading", dlnow, dltotal, data.ctx.ProgressCallBackData); !keep {
- data.ctx.ProgressCallBack = nil
- }
- }
+ data.totalSize = dltotal
return true
}