summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport/fetcher.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-20 01:29:13 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-20 01:29:13 (GMT)
commit8fc2a9c93d566feae576c1421b3c64dabc4b4976 (patch)
tree2fcef9fdc3fa620d44989985b1878b807dbe456f /src/helsinki.at/rhimport/fetcher.go
parent9f860e6f74791e103aed25a006dee55d7b3822b5 (diff)
improved type safety
Diffstat (limited to 'src/helsinki.at/rhimport/fetcher.go')
-rw-r--r--src/helsinki.at/rhimport/fetcher.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/helsinki.at/rhimport/fetcher.go b/src/helsinki.at/rhimport/fetcher.go
index 300abef..a8ac22c 100644
--- a/src/helsinki.at/rhimport/fetcher.go
+++ b/src/helsinki.at/rhimport/fetcher.go
@@ -101,7 +101,7 @@ func FetchFileCurl(ctx *ImportContext, res *FetchResult, uri *url.URL) (err erro
cbdata := &FetcherCurlCBData{remotename: path.Base(uri.Path)}
defer cbdata.Cleanup()
- if cbdata.basepath, err = ioutil.TempDir(ctx.Config.TempDir, "rhimportd-"); err != nil {
+ if cbdata.basepath, err = ioutil.TempDir(ctx.conf.TempDir, "rhimportd-"); err != nil {
return
}
@@ -142,7 +142,7 @@ func FetchFileLocal(ctx *ImportContext, res *FetchResult, uri *url.URL) (err err
ctx.ProgressCallBack(1, "fetching", 1.0, ctx.ProgressCallBackData)
}
- ctx.SourceFile = filepath.Join(ctx.Config.LocalFetchDir, path.Clean("/"+uri.Path))
+ ctx.SourceFile = filepath.Join(ctx.conf.LocalFetchDir, path.Clean("/"+uri.Path))
var src *os.File
if src, err = os.Open(ctx.SourceFile); err != nil {
res.ResponseCode = http.StatusBadRequest
@@ -194,13 +194,14 @@ func checkPassword(ctx *ImportContext, result *FetchResult) (err error) {
cached := true
for {
+ res_ch := make(chan getPasswordResult)
req := getPasswordRequest{}
req.username = ctx.UserName
req.cached = cached
- req.response = make(chan getPasswordResult)
- ctx.RdDb.getPasswordChan <- req
+ req.response = res_ch
+ ctx.rddb.getPasswordChan <- req
- res := <-req.response
+ res := <-res_ch
if res.err != nil {
return res.err
}