cURL / Mailing Lists / curl-library / Single Mail


Re: Using curl_multi interface with epoll (Daniel Stenberg)

From: Daniel Stenberg <>
Date: Thu, 10 Nov 2011 10:16:28 +0100 (CET)

On Tue, 8 Nov 2011, Yehezkel Horowitz wrote:

>> You need to switch over to the curl_multi_socket_action() paradigm
> 1. The example use curl_multi_socket API and not curl_multi_socket_action, I
> think it's good idea to update it.

Yes indeed. We'll greatly appreciate patches that improve our examples!

> 2. Something is not clear to me about the TIMER API: I understand the
> multi_timer_cb called whenever there is a change in the timeout and that it
> should schedule a call to timer_cb after the timeout reached. I don't
> understand if this should be periodic call or not (should the timer_cb
> schedule another call to itself after the timeout is reached again)? If it
> should be periodic, I think it'll be quite busy since I got timeout of just
> 1ms!

libcurl tells you about a timeout, and you should tell it when that timer has
expired. There's no periodic in there and I don't think anything in the
documentation suggests that. If libcurl asks for a 1ms timeout, then call it
after the duration of 1ms.

In most situations, libcurl will call your callback again with an updated
timer value (and hopefully an updated set of file descriptors).

> 3. I get into the following problem: Few jobs are running but till the next
> job will come, they will didn't get progress, after the next job is
> initiated - the running jobs get progress.

What eactly are the "jobs" and "next jobs" in your terminology? libcurl
doesn't really work on "jobs" as I see it.

> This problem is solved by calling to curl_multi_socket_all(multi,
> &still_running) instead of curl_multi_socket_action(multi,
> CURL_SOCKET_TIMEOUT, &still_runing). Did any one know about such problem?

Which libcurl on which operating system? And I also expect that you will have
to provide a much more detailed description for me to be able to actually help
rather than just guess.

> 4. Is there a strict order between the following?

> a. CURLMOPT_SOCKETFUNCTION is call to close the socket (with

> use the socket are called to write the response headers and body?

Surely you'll get the data (the (b) callbacks) before the socket is removed in
all cases?

List admin:
Received on 2011-11-10