cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLMOPT_MAXCONNECTS

From: Patrick Scott <phanna_at_google.com>
Date: Fri, 30 Jan 2009 21:12:47 -0500

(moved from curl-users to curl-library)

On Fri, Jan 30, 2009 at 4:58 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Fri, 30 Jan 2009, Patrick Scott wrote:
>
>> Well, I used curl_memdebug and the memory analyzer tool and it showed a
>> whole bunch of open file descriptors which I assume were left open due to
>> those dangling connections.
>
> Ah, right. That's actually pretty accurate so I would guess you've forgot to
> do some cleanup call or something then.
>
>> Where is that cleanup supposed to happen (I might not be doing something
>> properly in my app)?
>
> All easy handles must be closed with curl_easy_cleanup() and the multi
> handle with curl_multi_cleanup().

I do call curl_easy_cleanup for each handle that finishes. What if I
can't call curl_multi_cleanup for a long time? Do those dangling
connections stick around until I do? Where are they stored until they
are cleaned up if they are not in the cache (I'd like to do some
hacking of my own around parallel connections and pipelining)?

>
>> Ideally I would like the max connects option to put a hard limit on the
>> number of simultaneous connections that curl can handle.
>
> Well, it's quite easy for you to not add more handles than you'd like
> libcurl to simultaneously transfer.
>
>> Is there another option for that so curl_multi_add_handle returns an
>> error? Or can I call a function that tells me how many connections are
>> currently open?
>
> The curl_multi_perform() and curl_multi_socket*() functions all return the
> number of "active" transfers which is that number.

I can cap the number of requests I give to curl but how does
pipelining change that? Let's say I want to have a max of 5
simultaneous connections with each connection able to pipeline its
requests (if possible). How can I make sure that I limit the number of
connections to 5 without limiting the number of requests?

>
> --
>
> / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
> FAQ: http://curl.haxx.se/docs/faq.html
> Etiquette: http://curl.haxx.se/mail/etiquette.html
>
Received on 2009-01-31