cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl multi problem

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 25 Feb 2003 09:32:45 +0100 (CET)

On Mon, 24 Feb 2003, Avery Fay wrote:

> I'm currently migrating my app to the curl multi interface and I'm having a
> problem. Basically, I add 64 easy handles to the multi handle. Call perform
> and the app hangs. From gdb output it looks like gettimeofday is not
> returning. Also, netstat shows 64 open connections with data in the receive
> queue. Does this ring a bell with anyone?

Not to me. Is the number 64 a magic limit that makes this problem appear?

I can't understand why gettimeofday() would be a problem.

(And to be honest, I've never tried this amount of connections myself but I
can't see any reason why a larger amount would cause problems.)

> 1.) Is the multi interface thread safe? Can I have multiple threads each
> with their own multi handle?

Yes. The multi interface is as thread-safe as the rest of libcurl.

> 2.) After I call curl_multi_fdset, do I ever need to call it again? Does
> curl continue to use the same fdsets that I gave it?

You should basicly call curl_multi_fdset() whenever you're about to do
select(). Each easy-handle can (and will) change file handles in between
calls.

> 3.) If a function returns the error code that means I have to call
> curl_multi_perform again is it imperative that I call that before doing
> another select?

Well, it's highly recommended, not mandatory. If you select() before calling
it again, even though it returned CURLM_CALL_MULTI_PERFORM, libcurl may still
have data locally that it should send off to the peer or to a local callback.

-- 
 Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-02-25