lib: replace getsock() logic with pollsets

`getsock()` calls operated on a global limit that could
not be configure beyond 16 sockets. This is no longer adequate
with the new happy eyeballing strategy.

Instead, do the following:
- make `struct easy_pollset` dynamic. Starting with
  a minimal room for two sockets, the very common case,
  allow it to grow on demand.
- replace all protocol handler getsock() calls with pollsets
  and a CURLcode to return failures
- add CURLcode return for all connection filter `adjust_pollset()`
  callbacks, since they too can now fail.
- use appropriately in multi.c and multi_ev.c
- fix unit2600 to trigger pollset growth

Closes #18164
This commit is contained in:
Stefan Eissing 2025-08-04 16:17:37 +02:00 committed by Daniel Stenberg
parent c85c2b7be7
commit 5b80b4c012
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
54 changed files with 1002 additions and 873 deletions

View file

@ -682,11 +682,12 @@ out:
return result;
}
static void cf_h1_proxy_adjust_pollset(struct Curl_cfilter *cf,
struct Curl_easy *data,
struct easy_pollset *ps)
static CURLcode cf_h1_proxy_adjust_pollset(struct Curl_cfilter *cf,
struct Curl_easy *data,
struct easy_pollset *ps)
{
struct h1_tunnel_state *ts = cf->ctx;
CURLcode result = CURLE_OK;
if(!cf->connected) {
/* If we are not connected, but the filter "below" is
@ -698,13 +699,14 @@ static void cf_h1_proxy_adjust_pollset(struct Curl_cfilter *cf,
response headers or if we are still sending the request, wait
for write. */
if(tunnel_want_send(ts))
Curl_pollset_set_out_only(data, ps, sock);
result = Curl_pollset_set_out_only(data, ps, sock);
else
Curl_pollset_set_in_only(data, ps, sock);
result = Curl_pollset_set_in_only(data, ps, sock);
}
else
Curl_pollset_set_out_only(data, ps, sock);
result = Curl_pollset_set_out_only(data, ps, sock);
}
return result;
}
static void cf_h1_proxy_destroy(struct Curl_cfilter *cf,