cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: CURLMOPT_MAXCONNECTS

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 30 Jan 2009 22:58:01 +0100 (CET)

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().

> 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.

-- 
  / 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-30