cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to control number of open descriptors with curl_multi_socket

From: James Bursa <james_at_semichrome.net>
Date: Sun, 6 May 2007 20:34:19 -0500

On Sunday 06 May 2007 16:47, Daniel Stenberg wrote:
> libcurl has a connection cache which is on a per-multi handle basis and it
> can hold up to 4 times the number of added easy handles. But other than
> that, I don't think libcurl should keep any extra file descriptors around
> much.

I think there is a bug in curl_multi_add_handle(), and multi->connc->num is
used instead of multi->num_easy. This causes the cache to grow much faster
(e.g. to 40 with 3 easy handles).

James

--- lib/multi.c 2 May 2007 19:13:56 -0000 1.142
+++ lib/multi.c 7 May 2007 01:27:43 -0000
@@ -485,7 +485,7 @@
        the shared cache every single easy handle had 5 entries in their cache
        by default. */
     CURLcode res = Curl_ch_connc(easy_handle, multi->connc,
- multi->connc->num*4);
+ multi->num_easy * 4);
     if(res != CURLE_OK)
       /* TODO: we need to do some cleaning up here! */
       return CURLM_OUT_OF_MEMORY;
Received on 2007-05-07