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: Should we CURL_SOCKET_TIMEOUT after curl_multi_add_handle?

From: Daniel Stenberg via curl-library <curl-library_at_cool.haxx.se>
Date: Thu, 15 Oct 2020 08:21:53 +0200 (CEST)

On Wed, 14 Oct 2020, Jeff Mears via curl-library wrote:

> we're supposed to immediately call curl_multi_socket_action with
> CURL_SOCKET_TIMEOUT after starting a request.
>
> * Is it actually necessary to do this?

No, it's not strictly necessary but not doing so might delay the start of that
individual transfer.

When you add an easy handle to the multi handle, it doesn't actually kick off
the transfer. It is just puts it in a queue and sets a timeout to expire
immediately. When curl_multi_socket_action() subsequently is called, that new
handle's timeout will be detected and its transfers will get going.

> * How does this interact with an existing timeout that curl set before the
> handle was added? Do we continue to fire that later, or do we cancel it?

When curl sets a timeout with CURLMOPT_TIMERFUNCTION, that's a single timeout
(and single-shot) you hold and tell curl about when it expires. If curl then
needs *another* timeout, it will set a new one using the same callback. It
might also update (or cancel) the timeout even before the existing one times
out and then you modify the existing one. libcurl only asks that the
application maintains a single timeout.

-- 
  / 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-10-15