curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Adding/removing handles to the multi_handle produces unexpected result of curl_multi_perform

From: Patrick Schlangen via curl-library <curl-library_at_cool.haxx.se>
Date: Fri, 27 Sep 2019 17:20:11 +0200

Hi Denis,

> Am 27.09.2019 um 10:28 schrieb Denis Chapligin via curl-library <curl-library_at_cool.haxx.se>:
>
> curl_multi_add_handle(multi_handle, easy_handle);

can you log and check the return code of the curl_multi_add_handle calls? Maybe they fail for some reason. In general, I’d recommend to check all the return codes of every curl call.

Also I’d move the last curl_multi_perform call in line 53 (pastebin) before line 23 (so the order will be perform -> wait, as in the example [1]), to fix the following:
  * Currently you’re calling curl_multi_perform after every curl_multi_info_read, even if you didn’t add any new handles or didn’t wait for more I/O.
  * You’re also never calling curl_multi_perform again if none of the transfers has any messages/informationals available (some might be still active waiting for I/O, for example).

Best Regards,

Patrick

[1] https://curl.haxx.se/libcurl/c/curl_multi_wait.html

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-09-27