cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Detecting request completion with asynchronous interface

From: bp <bp.personal_at_gmail.com>
Date: Mon, 9 Mar 2009 11:13:33 -0400

On Sun, Mar 8, 2009 at 6:58 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> The primary hint: the 'running_handles' counter decreases.
>
> Then you use curl_multi_info_read() to figure out exactly which of the
> transfers that ended (if you use multiple) and what the return code from
> that particular transfer was.
>
> Good enough?

Using that counter seemed unreliable since maybe it could have been both
decremented and incremented since the last time checked, so perhaps always
calling curl_multi_info_read() would be better. Or maybe create many multi
handles that each service one easy request ... I was previously planning to
keep one multi handle around forever.

It sounds like we need to check for completion anywhere a running_handles is
returned:
1) After adding an easy handle and called curl_multi_socket_all().
2) After detecting socket activity and called curl_multi_socket_action()
with some fd.
3) After detecting a timeout and called curl_multi_socket_action() with
CURL_SOCKET_TIMEOUT.

Does this cover all possible completions?

Thanks,
Brandon Phillips / Lockheed-Martin IS&GS
Received on 2009-03-09