cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLMOPT_MAXCONNECTS

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 2 Feb 2009 22:29:03 +0100 (CET)

On Mon, 2 Feb 2009, Patrick Scott wrote:

> Attached is the source of 10-at-a-time.c modified to load all the urls at
> the same time.

Thanks!

Uhm, it is indeed a leak and I feel a bit embarrased it was this serious. I
tightened the leak for the tests I've run by using this little fix:

--- lib/url.c 2 Feb 2009 16:19:23 -0000 1.785
+++ lib/url.c 2 Feb 2009 21:30:52 -0000
@@ -4804,8 +4804,12 @@
       state it is for re-using, so we're forced to close it. In a perfect world
       we can add code that keep track of if we really must close it here or not,
       but currently we have no such detail knowledge.
+
+ connectindex == -1 here means that the connection has no spot in the
+ connection cache and thus we must disconnect it here.
    */
- if(data->set.reuse_forbid || conn->bits.close || premature) {
+ if(data->set.reuse_forbid || conn->bits.close || premature ||
+ (-1 == conn->connectindex)) {
      CURLcode res2 = Curl_disconnect(conn); /* close the connection */

      /* If we had an error already, make sure we return that one. But

I'll commit this to CVS just now, so if this does not heal the problem for you
please let me know!

-- 
  / daniel.haxx.se
Received on 2009-02-02