cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl-library Digest, Vol 45, Issue 34

From: Nick Gerner <nick_at_seomoz.org>
Date: Mon, 18 May 2009 08:05:52 -0700

>> while stuff is in flight or there's more work to do from an external queue
>>  1) add some work to the handle if there's any in the external queue
>>  2) if we just added call curl_multi_perform in a while loop
>>  3) poll on relevant handles
>>  4) call curl_multi_socket_action on the relevant socket
>>
>> But it seems as if I wasn't getting the socket callback when I had step 2
>> (the curl_multi_perform).  If I remove it everything works properly.  So I
>> guess I found my fix :)
>>
>> But is this expected?
>
> Yes. I think we perhaps need to spell it out better in the docs somehow, but
> you really should not mix curl_multi_perform with curl_multi_socket_action on
> the same multi handle. You will no doubt get funny results such as the one you
> mention here. And really, if you want the callbacks for sockets you have no
> reason to use curl_multi_perform().
>
> What is the reason you want to use both?
>
> --
>
>  / daniel.haxx.se
>

I don't actually want to use both, I just wanted to confirm that there
aren't other issues going on. As I mentioned, I wrote it naively
(inspired by curl_easy_perform) at first and then converted it to
using the socket call backs. I then spent some time agonizing over
what was going on before I realized that leaving that
curl_multi_perform after adding new handles was the issue.

Thanks!

--Nick
Received on 2009-05-18