multi, signal network changed

A modified version of #17246 for signalling changes in network:

New multi option `CURLMOPT_NETWORK_CHANGED` with a long value:
0 - does nothing
1 - do not reuse existing connections
2 - as 1, but also clear DNS cache

One could also make the long a bitmask, if people want more control.

Documentation to be added if this gets the vote to go forward.
This commit is contained in:
Stefan Eissing 2025-06-13 12:38:44 +02:00
parent 7b8594176d
commit b1e6bae277
No known key found for this signature in database
14 changed files with 257 additions and 4 deletions

View file

@ -3235,6 +3235,18 @@ CURLMcode curl_multi_setopt(CURLM *m,
multi->max_concurrent_streams = (unsigned int)streams;
}
break;
case CURLMOPT_NETWORK_CHANGED: {
long val = va_arg(param, long);
if(val >= 2) {
/* clear DNS cache */
Curl_dnscache_clear(multi->admin);
}
if(val >= 1) {
/* do not reuse existing connections */
Curl_cpool_nw_changed(multi->admin);
}
break;
}
default:
res = CURLM_UNKNOWN_OPTION;
break;