mirror of
https://github.com/curl/curl.git
synced 2026-07-16 07:27:15 +03:00
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:
parent
c85c2b7be7
commit
5b80b4c012
54 changed files with 1002 additions and 873 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include "multiif.h"
|
||||
#include "cf-https-connect.h"
|
||||
#include "http2.h"
|
||||
#include "select.h"
|
||||
#include "vquic/vquic.h"
|
||||
|
||||
/* The last 3 #include files should be in this order */
|
||||
|
|
@ -426,22 +427,24 @@ static CURLcode cf_hc_shutdown(struct Curl_cfilter *cf,
|
|||
return result;
|
||||
}
|
||||
|
||||
static void cf_hc_adjust_pollset(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
static CURLcode cf_hc_adjust_pollset(struct Curl_cfilter *cf,
|
||||
struct Curl_easy *data,
|
||||
struct easy_pollset *ps)
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
if(!cf->connected) {
|
||||
struct cf_hc_ctx *ctx = cf->ctx;
|
||||
size_t i;
|
||||
|
||||
for(i = 0; i < ctx->baller_count; i++) {
|
||||
for(i = 0; (i < ctx->baller_count) && !result; i++) {
|
||||
struct cf_hc_baller *b = &ctx->ballers[i];
|
||||
if(!cf_hc_baller_is_active(b))
|
||||
continue;
|
||||
Curl_conn_cf_adjust_pollset(b->cf, data, ps);
|
||||
result = Curl_conn_cf_adjust_pollset(b->cf, data, ps);
|
||||
}
|
||||
CURL_TRC_CF(data, cf, "adjust_pollset -> %d socks", ps->num);
|
||||
CURL_TRC_CF(data, cf, "adjust_pollset -> %d, %d socks", result, ps->n);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool cf_hc_data_pending(struct Curl_cfilter *cf,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue