cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_socket_action: second argument?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sat, 23 Jun 2012 22:54:25 +0200 (CEST)

On Thu, 21 Jun 2012, Felix E. Klee wrote:

> Concerning the timer / timeouts, some more questions:
>
> * Why is it necessary to repeatedly call `curl_multi_socket_action` with
> `CURL_SOCKET_TIMEOUT`? After a socket has been created, isn't it
> sufficient to only watch actions on the socket?
>
> After all, each socket is associated with an easy handle.

Because things in libcurl can trigger on time and not just on socket activity!
Things like retries or transfer-speed checks and whatever. Lots of operations
also have a maximum time so that a handle won't stick in a state forever. This
is especially true if you set a timeout with the API.

> * How is the timeout value determined internally?

The code sets a timeout value where applicable. See
lib/multi.c:multi_timeout() for the specific function that handles it
internally. libcurl can hold multiple timeouts for each handle, but only the
nearest in time value is what is told to the timer callback.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2012-06-23