52
52
// https://curl.se/libcurl/c/curl_easy_getinfo.html
53
53
// https://curl.se/libcurl/c/curl_easy_setopt.html
54
54
55
- # define AX_CURL_POLL_TIMEOUT_MS 1000 // wait until DNS query done
55
+ # define AX_CURL_POLL_TIMEOUT_MS 1000
56
56
57
57
enum
58
58
{
@@ -611,7 +611,6 @@ class DownloaderCURL::Impl : public std::enable_shared_from_this<DownloaderCURL:
611
611
612
612
// remove from multi-handle
613
613
curl_multi_remove_handle (curlmHandle, curlHandle);
614
- bool reinited = false ;
615
614
do
616
615
{
617
616
auto coTask = static_cast <DownloadTaskCURL*>(task->_coTask .get ());
@@ -623,7 +622,7 @@ class DownloaderCURL::Impl : public std::enable_shared_from_this<DownloaderCURL:
623
622
curl_easy_getinfo (curlHandle, CURLINFO_RESPONSE_CODE, &responeCode);
624
623
fmt::format_to (std::back_inserter (errorMsg), FMT_COMPILE (" : {}" ), responeCode);
625
624
}
626
-
625
+
627
626
coTask->setErrorDesc (DownloadTask::ERROR_IMPL_INTERNAL, errCode, std::move (errorMsg));
628
627
break ;
629
628
}
@@ -669,9 +668,12 @@ class DownloaderCURL::Impl : public std::enable_shared_from_this<DownloaderCURL:
669
668
}
670
669
671
670
// process tasks in _requestList
672
- auto size = coTaskMap.size ();
673
- while (0 == countOfMaxProcessingTasks || size < countOfMaxProcessingTasks)
671
+ while (true )
674
672
{
673
+ // Check for set task limit
674
+ if (countOfMaxProcessingTasks && coTaskMap.size () >= countOfMaxProcessingTasks)
675
+ break ;
676
+
675
677
// get task wrapper from request queue
676
678
std::shared_ptr<DownloadTask> task;
677
679
{
0 commit comments