connection: attached transfer count

Since we no longer traverse the transfers attached to a connection,
change the sparse bitset to just a `uint32_t` counter.

This makes multi_ev the single user of sparse bitsets for transfers
using a socket and allocation failures are handled there correctly.

Refs #19818
Closes #19836
This commit is contained in:
Stefan Eissing 2025-12-04 17:15:33 +01:00 committed by Daniel Stenberg
parent 1def380032
commit d7928029fc
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
10 changed files with 29 additions and 44 deletions

View file

@ -2718,7 +2718,7 @@ static CURLcode cf_ngtcp2_query(struct Curl_cfilter *cf,
}
else if(ctx->max_bidi_streams) {
uint64_t avail_bidi_streams = 0;
uint64_t max_streams = CONN_ATTACHED(cf->conn);
uint64_t max_streams = cf->conn->attached_xfers;
if(ctx->max_bidi_streams > ctx->used_bidi_streams)
avail_bidi_streams = ctx->max_bidi_streams - ctx->used_bidi_streams;
max_streams += avail_bidi_streams;
@ -2728,7 +2728,7 @@ static CURLcode cf_ngtcp2_query(struct Curl_cfilter *cf,
*pres1 = (int)Curl_multi_max_concurrent_streams(data->multi);
CURL_TRC_CF(data, cf, "query conn[%" FMT_OFF_T "]: "
"MAX_CONCURRENT -> %d (%u in use)",
cf->conn->connection_id, *pres1, CONN_ATTACHED(cf->conn));
cf->conn->connection_id, *pres1, cf->conn->attached_xfers);
CF_DATA_RESTORE(cf, save);
return CURLE_OK;
}

View file

@ -2323,7 +2323,7 @@ static CURLcode cf_osslq_query(struct Curl_cfilter *cf,
return CURLE_HTTP3;
}
/* we report avail + in_use */
v += CONN_ATTACHED(cf->conn);
v += cf->conn->attached_xfers;
*pres1 = (v > INT_MAX) ? INT_MAX : (int)v;
#else
*pres1 = 100;

View file

@ -1493,14 +1493,14 @@ static CURLcode cf_quiche_query(struct Curl_cfilter *cf,
switch(query) {
case CF_QUERY_MAX_CONCURRENT: {
uint64_t max_streams = CONN_ATTACHED(cf->conn);
uint64_t max_streams = cf->conn->attached_xfers;
if(!ctx->goaway && ctx->qconn) {
max_streams += quiche_conn_peer_streams_left_bidi(ctx->qconn);
}
*pres1 = (max_streams > INT_MAX) ? INT_MAX : (int)max_streams;
CURL_TRC_CF(data, cf, "query conn[%" FMT_OFF_T "]: "
"MAX_CONCURRENT -> %d (%u in use)",
cf->conn->connection_id, *pres1, CONN_ATTACHED(cf->conn));
cf->conn->connection_id, *pres1, cf->conn->attached_xfers);
return CURLE_OK;
}
case CF_QUERY_CONNECT_REPLY_MS: