Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
Hitenjain14 committed Jun 18, 2024
1 parent 59c9c7f commit a7df55b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions zboxcore/sdk/blockdownloadworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion zboxcore/zboxutil/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a7df55b

Please sign in to comment.