aboutsummaryrefslogtreecommitdiff
path: root/lib/multi.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-09-16 21:50:29 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-09-16 21:50:29 +0000
commit2d5fc39d3573c10a460cdeb2139631da62b8e391 (patch)
tree7a10af6d214a8b45860080bf357969f4223e040c /lib/multi.c
parentc001ed53fa89f203e3d6aa402e9a9126dc34f5b1 (diff)
Resize the connection cache upwards when adding more handles than what
currently fits in the cache, to make the cache work better especially for pipelining cases but also for "mere" (persistent) connection re-use.
Diffstat (limited to 'lib/multi.c')
-rw-r--r--lib/multi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/multi.c b/lib/multi.c
index 77c6a9fb4..2f7f32870 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -423,6 +423,18 @@ CURLMcode curl_multi_add_handle(CURLM *multi_handle,
/* increase the node-counter */
multi->num_easy++;
+
+ if((multi->num_easy+5) > multi->connc->num) {
+ /* we want the connection cache to have room for all easy transfers, and
+ some more so we have a margin of 5 for now, but we add the new amount
+ plus 10 to not have to do it for every new handle added */
+ CURLcode res = Curl_ch_connc(easy_handle, multi->connc,
+ multi->num_easy + 10);
+ if(res)
+ /* TODO: we need to do some cleaning up here! */
+ return res;
+ }
+
/* increase the alive-counter */
multi->num_alive++;