]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ConnectionDone: default maxconnects to 4 x number of easy handles
authorShao Shuchao <sshao@websense.com>
Mon, 17 Feb 2014 05:44:00 +0000 (13:44 +0800)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 17 Feb 2014 08:29:25 +0000 (09:29 +0100)
... as documented!

lib/multi.c
lib/url.c

index b3b57161287de84b59ebf8f032edc0bdf7d480d5..02d225759f6bffaa1f613e9442a49a23b7bcc549 100644 (file)
@@ -317,6 +317,9 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */
   multi->closure_handle->state.conn_cache = multi->conn_cache;
 
   multi->max_pipeline_length = 5;
+
+  /* -1 means it not set by user, use the default value */
+  multi->maxconnects = -1;
   return (CURLM *) multi;
 
   error:
index c0aebef16e5fa2c9e2b551f3ef920074ec91f658..4d7508eeedee4864e7a42b979eca505be11a0041 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -3190,7 +3190,8 @@ ConnectionDone(struct SessionHandle *data, struct connectdata *conn)
 {
   /* data->multi->maxconnects can be negative, deal with it. */
   size_t maxconnects =
-    (data->multi->maxconnects < 0) ? 0 : data->multi->maxconnects;
+    (data->multi->maxconnects < 0) ? data->multi->num_easy * 4:
+    data->multi->maxconnects;
   struct connectdata *conn_candidate = NULL;
 
   /* Mark the current connection as 'unused' */