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: Calling curl_easy_pause in CURLOPT_XFERINFOFUNCTION and delay/frequency issue

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 15 Jul 2020 14:20:36 +0200 (CEST)

On Tue, 14 Jul 2020, Mushegh Malkhasyan via curl-library wrote:

> I noticed that in the documentation it states that the unpausing should be
> called from a callback thread.

I truly hope (and believe) none of our docs use such wording. There's no
"callback thread" with libcurl - it's all done in the same thread.

But yes, if you use the easy interface there's a limited ability to get a
transfer going again and using a callback seems like a decent approach then.

> I modified my code to trigger the unpausing from the transfer function
> (CURLOPT_XFERINFOFUNCTION) but it seems that this function also has a wide
> variability in the frequency of the call.

Yes. It may be called as rarely as once per second.

> Can I actually call curl unpause from an unrelated thread (seem to work on
> all platforms).

No. That would mean "acessing one handle in more than one thread in parallel"
which something we explicitly don't support or guarantee. While you may see it
working now, there's no API or behavior guarantees around that.

> In case of unpausing from the transfer/progress update callback – how can I
> make it to be called more frequent so I can unpause in time?

If up to a second delay to resume transfer is a concern, I would recommend
*not* using the easy interface but instead switch to the multi interface as
then you can deal with the select() yourself and introduce "instant resume" if
you want to. You could even use curl_multi_poll() and curl_multi_wakeup() to
make it happen.

-- 
  / daniel.haxx.se | Commercial curl support up to 24x7 is available!
                   | Private help, bug fixes, support, ports, new features
                   | https://www.wolfssl.com/contact/

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-07-15