mirror of
https://github.com/curl/curl.git
synced 2026-08-26 15:43:33 +03:00
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.
This commit is contained in:
parent
c001ed53fa
commit
2d5fc39d35
4 changed files with 62 additions and 41 deletions
12
lib/multi.c
12
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++;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue