cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Close callback [Discussion]

From: Ingo Krabbe <ikrabbe.ask_at_web.de>
Date: Sat, 8 Mar 2008 12:58:27 +0100

Am Samstag, 8. März 2008 12:36:21 schrieb Jeff Pohlmeyer:
> On Sat, Mar 8, 2008 at 4:56 AM, Ingo Krabbe <ikrabbe.ask_at_web.de> wrote:
> > Now my question is: Where Do I find the readiness of the URL request
> > here ?
>
> I don't have QT installed here so I can't try your example,
> but just from glancing at the sources...
>
> Each time you do this:
>
> while(CURLM_CALL_MULTI_PERFORM==
> (code= curl_multi_socket_all(global.curl,&global.handles)));
>
> you should save the previous value of global.handles
> ( maybe name it "global.previous" or something similar )
>
> Then you can compare the previous value against the current value
> and when the number of running handles has changed, you will
> know that it is time to call your curl_multi_info_read() loop
> to find out which transfers have completed.
>
>
> - Jeff

Yes you are right. I've done this now and finished the example just as I want
it to run (process on done requests), though the real work has to be done
during io callbacks since I need the current request that I work upon:

        handle_ofs = global->handles;
        while ( CURLM_CALL_MULTI_PERFORM ==
                (code = curl_multi_socket_action(global->curl,
                                         fd, 0, &global->handles)) );
        handle_ofs -= global->handles;

        if ( handle_ofs != 0 ) {
                /* here the check can be done */
        }

since then I can also pass the URL context url_opdat to the handler by using
global->lastop which i initialize in incoming_list.

Received on 2008-03-08