cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to list easy handles from a multi handle

From: Jeroen Ooms <jeroenooms_at_gmail.com>
Date: Sun, 5 Jun 2016 19:50:14 +0200

On Fri, Jun 3, 2016 at 10:36 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 3 Jun 2016, Jeroen Ooms wrote:
>
>> Another approach: is it legal to call curl_multi_remove_handle() with an
>> easy handle that was already removed earlier from the multi handle? What
>> would be the expected response code?
>
> It'll just immediately return CURLM_OK.

Thank you. Two more brief questions re multi handles :-)

 1) Does curl_multi_cleanup() automatically remove all easy handles
before freeing the multi handle? I tried this below and it seemed to
work for my version of libcurl. Can I rely on this behavior?

  CURL *handle = curl_easy_init();
  CURLM *multi1 = curl_multi_init();
  CURLM *multi2 = curl_multi_init();
  curl_multi_add_handle(multi1, handle);
  curl_multi_cleanup(multi1);
  curl_multi_add_handle(multi2, handle);

I understand we still need curl_easy_cleanup to free the individual
handles. My main concern is if easy handles don't get permanently
corrupted or locked if their multi handle is cleaned up, without
explicitly removing them first.

 2) Is it allowed to call curl_multi_setopt on the multi handle after
calling curl_multi_perform?

As described earlier the application has a long running multi handle
with easy handels dynamically added and removed. Suppose at some point
we want to increase CURLMOPT_MAX_HOST_CONNECTIONS or enable
CURLPIPE_MULTIPLEX. Is it possible to set these options on a multi
handle in between curl_multi_perform calls? Will it only affect future
handles?
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-06-05