multi: add CURLMOPT_NETWORK_CHANGED to signal network changed

New multi option CURLMOPT_NETWORK_CHANGED with a long bitmask value:

- CURLM_NWCOPT_CLEAR_CONNS: do not reuse existing connections, close all
  idle connections.

- CURLM_NWCOPT_CLEAR_DNS: clear the multi's DNS cache.

All other bits reserved for future extensions.

Fixes #17225
Reported-by: ウさん
Closes #17613
This commit is contained in:
Stefan Eissing 2025-06-13 12:38:44 +02:00 committed by Daniel Stenberg
parent 7b8594176d
commit 55c045c863
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
19 changed files with 354 additions and 4 deletions

View file

@ -395,9 +395,23 @@ typedef enum {
/* maximum number of concurrent streams to support on a connection */
CURLOPT(CURLMOPT_MAX_CONCURRENT_STREAMS, CURLOPTTYPE_LONG, 16),
/* network has changed, adjust caches/connection reuse */
CURLOPT(CURLMOPT_NETWORK_CHANGED, CURLOPTTYPE_LONG, 17),
CURLMOPT_LASTENTRY /* the last unused */
} CURLMoption;
/* Definition of bits for the CURLMOPT_NETWORK_CHANGED argument: */
/* - CURLM_NWCOPT_CLEAR_CONNS tells libcurl to prevent further reuse
of existing connections. Connections that are idle will be closed.
Ongoing transfers will continue with the connection they have. */
#define CURLM_NWCOPT_CLEAR_CONNS (1L<<0)
/* - CURLM_NWCOPT_CLEAR_DNS tells libcurl to prevent further reuse
of existing connections. Connections that are idle will be closed.
Ongoing transfers will continue with the connection they have. */
#define CURLM_NWCOPT_CLEAR_DNS (1L<<0)
/*
* Name: curl_multi_setopt()