cpool/cshutdown: force close connections under pressure

when CURLMOPT_MAX_HOST_CONNECTIONS or CURLMOPT_MAX_TOTAL_CONNECTIONS
limits are reached, force close connections in shutdown to go below
limit when possible.

Fixes #17020
Reported-by: Fujii Hironori
Closes #17022
This commit is contained in:
Stefan Eissing 2025-04-11 12:05:05 +02:00 committed by Daniel Stenberg
parent 9f8bdd0eae
commit ff37657e4d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
5 changed files with 108 additions and 34 deletions

View file

@ -75,6 +75,12 @@ size_t Curl_cshutdn_count(struct Curl_easy *data);
size_t Curl_cshutdn_dest_count(struct Curl_easy *data,
const char *destination);
/* Close the oldest connection in shutdown to destination or,
* when destination is NULL for any destination.
* Return TRUE if a connection has been closed. */
bool Curl_cshutdn_close_oldest(struct Curl_easy *data,
const char *destination);
/* Add a connection to have it shut down. Will terminate the oldest
* connection when total connection limit of multi is being reached. */
void Curl_cshutdn_add(struct cshutdn *cshutdn,