cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: mixing curl_multi_perform and curl_multi_socket

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 18 May 2009 08:58:59 +0200 (CEST)

On Sun, 17 May 2009, Nick Gerner wrote:

> First, and unrelated http://curl.haxx.se/libcurl/c/curl_multi_socket.html
> says to look at http://curl.haxx.se/libcurl/c/curl_multi_socket_action.html
> but that gives me a 404.

Oops. I recently split off the *action() page from the other two functions to
easier handle them as deprecated vs favored, and I didn't do everything right
it seems! Fixed now.

> 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
Received on 2009-05-18