multi = Curl_multi_handle(1, 3, 7);
if(!multi)
return CURLE_OUT_OF_MEMORY;
- data->multi_easy = multi;
}
if(multi->in_callback)
/* Copy the MAXCONNECTS option to the multi handle */
curl_multi_setopt(multi, CURLMOPT_MAXCONNECTS, (long)data->set.maxconnects);
+ data->multi_easy = NULL; /* pretend it does not exist */
mcode = curl_multi_add_handle(multi, data);
if(mcode) {
curl_multi_cleanup(multi);
- data->multi_easy = NULL;
if(mcode == CURLM_OUT_OF_MEMORY)
return CURLE_OUT_OF_MEMORY;
return CURLE_FAILED_INIT;
}
+ /* assign this after curl_multi_add_handle() */
+ data->multi_easy = multi;
+
sigpipe_ignore(data, &pipe_st);
/* run the transfer */
multi->dead = FALSE;
}
+ if(data->multi_easy) {
+ /* if this easy handle was previously used for curl_easy_perform(), there
+ is a private multi handle here that we can kill */
+ curl_multi_cleanup(data->multi_easy);
+ data->multi_easy = NULL;
+ }
+
/* Initialize timeout list for this handle */
Curl_llist_init(&data->state.timeoutlist, NULL);