Skip to content

Commit

Permalink
fixed issue #40
Browse files Browse the repository at this point in the history
curl handles should NOT be added when there are transfers going on!!!
  • Loading branch information
fangfufu committed Aug 31, 2019
1 parent a2587ca commit d6fbcb4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ void transfer_blocking(CURL *curl)
transfer.transferring = 1;
curl_easy_setopt(curl, CURLOPT_PRIVATE, &transfer);

pthread_mutex_lock(&transfer_lock);
CURLMcode res = curl_multi_add_handle(curl_multi, curl);
pthread_mutex_unlock(&transfer_lock);

if(res > 0) {
fprintf(stderr, "transfer_blocking(): %d, %s\n",
Expand All @@ -343,7 +345,10 @@ void transfer_blocking(CURL *curl)

void transfer_nonblocking(CURL *curl)
{
pthread_mutex_lock(&transfer_lock);
CURLMcode res = curl_multi_add_handle(curl_multi, curl);
pthread_mutex_unlock(&transfer_lock);

if(res > 0) {
fprintf(stderr, "transfer_nonblocking(): %s\n",
curl_multi_strerror(res));
Expand Down

0 comments on commit d6fbcb4

Please sign in to comment.