url: reduce complexity of url_match_conn

Split off the function code into several static helpers according to
aspects checked.

closes #17408
This commit is contained in:
Stefan Eissing 2025-05-21 13:11:06 +02:00 committed by Daniel Stenberg
parent e1f65937a9
commit 35e1e7be22
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 294 additions and 178 deletions

View file

@ -832,6 +832,8 @@ void Curl_detach_connection(struct Curl_easy *data)
struct connectdata *conn = data->conn;
if(conn) {
Curl_uint_spbset_remove(&conn->xfers_attached, data->mid);
if(Curl_uint_spbset_empty(&conn->xfers_attached))
conn->attached_multi = NULL;
}
data->conn = NULL;
}
@ -849,6 +851,11 @@ void Curl_attach_connection(struct Curl_easy *data,
DEBUGASSERT(conn);
data->conn = conn;
Curl_uint_spbset_add(&conn->xfers_attached, data->mid);
/* all attached transfers must be from the same multi */
if(!conn->attached_multi)
conn->attached_multi = data->multi;
DEBUGASSERT(conn->attached_multi == data->multi);
if(conn->handler && conn->handler->attach)
conn->handler->attach(data, conn);
}