From a7df55b1267af7236ddeb1ec7a8ffeff90646220 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Tue, 18 Jun 2024 21:42:41 +0530 Subject: [PATCH] fix build --- zboxcore/sdk/blockdownloadworker.go | 4 ++-- zboxcore/zboxutil/http.go | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/zboxcore/sdk/blockdownloadworker.go b/zboxcore/sdk/blockdownloadworker.go index 9a3a77e35..603003903 100644 --- a/zboxcore/sdk/blockdownloadworker.go +++ b/zboxcore/sdk/blockdownloadworker.go @@ -79,12 +79,12 @@ func InitBlockDownloader(blobbers []*blockchain.StorageNode, workerCount int) { for _, blobber := range blobbers { if _, ok := downloadBlockChan[blobber.ID]; !ok { downloadBlockChan[blobber.ID] = make(chan *BlockDownloadRequest, workerCount) - go startBlockDownloadWorker(downloadBlockChan[blobber.ID], workerCount, blobber.ID, blobber.Baseurl) + go startBlockDownloadWorker(downloadBlockChan[blobber.ID], workerCount) } } } -func startBlockDownloadWorker(blobberChan chan *BlockDownloadRequest, workers int, id, baseURL string) { +func startBlockDownloadWorker(blobberChan chan *BlockDownloadRequest, workers int) { sem := semaphore.NewWeighted(int64(workers)) fastClient := zboxutil.GetFastHTTPClient() for { diff --git a/zboxcore/zboxutil/http.go b/zboxcore/zboxutil/http.go index 8fe9d826a..65f038c88 100644 --- a/zboxcore/zboxutil/http.go +++ b/zboxcore/zboxutil/http.go @@ -132,7 +132,11 @@ func (pfe *proxyFromEnv) isLoopback(host string) (ok bool) { } func GetFastHTTPClient() *fasthttp.Client { - return FastHttpClient.(*fasthttp.Client) + fc, ok := FastHttpClient.(*fasthttp.Client) + if ok { + return fc + } + return nil } func (pfe *proxyFromEnv) Proxy(req *http.Request) (proxy *url.URL, err error) {