conncache: count shutdowns against host and max limits

Count connections to a host against a possibly configured destination
limit. Trigger multi `connchange` when a connection has been shutdown,
so pending transfers can try to get a connection once again.

Reported-by: baranyaib90 on github
Fixes #15857
Closes #15879
This commit is contained in:
Stefan Eissing 2024-12-31 16:24:46 +01:00 committed by Daniel Stenberg
parent 508861eb80
commit bd3c027ac9
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 102 additions and 21 deletions

View file

@ -3031,9 +3031,11 @@ CURLMcode curl_multi_perform(CURLM *m, int *running_handles)
sigpipe_apply(multi->cpool.idata, &pipe_st);
Curl_cpool_multi_perform(multi);
sigpipe_restore(&pipe_st);
if(multi_ischanged(m, TRUE))
process_pending_handles(m);
/*
* Simply remove all expired timers from the splay since handles are dealt
* with unconditionally by this function and curl_multi_timeout() requires
@ -3629,6 +3631,9 @@ out:
}
sigpipe_restore(&mrc.pipe_st);
if(multi_ischanged(multi, TRUE))
process_pending_handles(multi);
if(running_handles)
*running_handles = (int)multi->num_alive;
@ -3686,9 +3691,6 @@ CURLMcode curl_multi_setopt(CURLM *m,
break;
case CURLMOPT_MAX_TOTAL_CONNECTIONS:
multi->max_total_connections = va_arg(param, long);
/* for now, let this also decide the max number of connections
* in shutdown handling */
multi->max_shutdown_connections = va_arg(param, long);
break;
/* options formerly used for pipelining */
case CURLMOPT_MAX_PIPELINE_LENGTH: