|
|
|
@ -291,11 +291,7 @@ static struct active_request_slot *get_active_slot(void)
@@ -291,11 +291,7 @@ static struct active_request_slot *get_active_slot(void)
|
|
|
|
|
} |
|
|
|
|
if (slot == NULL) { |
|
|
|
|
newslot = xmalloc(sizeof(*newslot)); |
|
|
|
|
#ifdef NO_CURL_EASY_DUPHANDLE |
|
|
|
|
newslot->curl = get_curl_handle(); |
|
|
|
|
#else |
|
|
|
|
newslot->curl = curl_easy_duphandle(curl_default); |
|
|
|
|
#endif |
|
|
|
|
newslot->curl = NULL; |
|
|
|
|
newslot->in_use = 0; |
|
|
|
|
newslot->next = NULL; |
|
|
|
|
|
|
|
|
@ -311,6 +307,14 @@ static struct active_request_slot *get_active_slot(void)
@@ -311,6 +307,14 @@ static struct active_request_slot *get_active_slot(void)
|
|
|
|
|
slot = newslot; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (slot->curl == NULL) { |
|
|
|
|
#ifdef NO_CURL_EASY_DUPHANDLE |
|
|
|
|
slot->curl = get_curl_handle(); |
|
|
|
|
#else |
|
|
|
|
slot->curl = curl_easy_duphandle(curl_default); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
active_requests++; |
|
|
|
|
slot->in_use = 1; |
|
|
|
|
slot->done = 0; |
|
|
|
@ -612,6 +616,7 @@ void process_curl_messages(void)
@@ -612,6 +616,7 @@ void process_curl_messages(void)
|
|
|
|
|
void process_request_queue(void) |
|
|
|
|
{ |
|
|
|
|
struct transfer_request *request = request_queue_head; |
|
|
|
|
struct active_request_slot *slot = active_queue_head; |
|
|
|
|
int num_transfers; |
|
|
|
|
|
|
|
|
|
while (active_requests < max_requests && request != NULL) { |
|
|
|
@ -624,6 +629,14 @@ void process_request_queue(void)
@@ -624,6 +629,14 @@ void process_request_queue(void)
|
|
|
|
|
} |
|
|
|
|
request = request->next; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
while (slot != NULL) { |
|
|
|
|
if (!slot->in_use && slot->curl != NULL) { |
|
|
|
|
curl_easy_cleanup(slot->curl); |
|
|
|
|
slot->curl = NULL; |
|
|
|
|
} |
|
|
|
|
slot = slot->next; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
@ -1297,6 +1310,7 @@ int main(int argc, char **argv)
@@ -1297,6 +1310,7 @@ int main(int argc, char **argv)
|
|
|
|
|
#endif |
|
|
|
|
slot = active_queue_head; |
|
|
|
|
while (slot != NULL) { |
|
|
|
|
if (slot->curl != NULL) |
|
|
|
|
curl_easy_cleanup(slot->curl); |
|
|
|
|
slot = slot->next; |
|
|
|
|
} |
|
|
|
|