connection bits: move 'connect_only' here

Move the bit `connection_only` from `connectdata` to `ConnectBits`.
Since we keep all other bits there, seems the correct place.

Closes #20959
This commit is contained in:
Stefan Eissing 2026-03-17 13:57:42 +01:00 committed by Daniel Stenberg
parent 1098e1044e
commit aeee5dd616
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
9 changed files with 14 additions and 13 deletions

View file

@ -206,7 +206,7 @@ static void cpool_discard_conn(struct cpool *cpool,
/* treat the connection as aborted in CONNECT_ONLY situations, we do
* not know what the APP did with it. */
if(conn->connect_only)
if(conn->bits.connect_only)
aborted = TRUE;
conn->bits.aborted = aborted;
@ -354,7 +354,7 @@ static struct connectdata *cpool_get_oldest_idle(struct cpool *cpool,
for(curr = Curl_llist_head(&bundle->conns); curr;
curr = Curl_node_next(curr)) {
conn = Curl_node_elem(curr);
if(CONN_INUSE(conn) || conn->bits.close || conn->connect_only)
if(CONN_INUSE(conn) || conn->bits.close || conn->bits.connect_only)
continue;
/* Set higher score for the age passed since the connection was used */
score = curlx_ptimediff_ms(pnow, &conn->lastused);
@ -665,7 +665,7 @@ void Curl_conn_terminate(struct Curl_easy *data,
/* treat the connection as aborted in CONNECT_ONLY situations,
* so no graceful shutdown is attempted. */
if(conn->connect_only)
if(conn->bits.connect_only)
aborted = TRUE;
if(data->multi) {

View file

@ -87,14 +87,14 @@ static void cshutdn_run_once(struct Curl_easy *data,
return;
}
if(!conn->connect_only && Curl_conn_is_connected(conn, FIRSTSOCKET))
if(!conn->bits.connect_only && Curl_conn_is_connected(conn, FIRSTSOCKET))
r1 = Curl_conn_shutdown(data, FIRSTSOCKET, &done1);
else {
r1 = CURLE_OK;
done1 = TRUE;
}
if(!conn->connect_only && Curl_conn_is_connected(conn, SECONDARYSOCKET))
if(!conn->bits.connect_only && Curl_conn_is_connected(conn, SECONDARYSOCKET))
r2 = Curl_conn_shutdown(data, SECONDARYSOCKET, &done2);
else {
r2 = CURLE_OK;

View file

@ -1821,7 +1821,7 @@ out:
/* Defer flushing during the connect phase so that the SETTINGS and
* other initial frames are sent together with the first request.
* Unless we are 'connect_only' where the request will never come. */
if(!cf->connected && !cf->conn->connect_only)
if(!cf->connected && !cf->conn->bits.connect_only)
return CURLE_OK;
return nw_out_flush(cf, data);
}

View file

@ -729,7 +729,7 @@ static void close_connect_only(struct connectdata *conn,
{
(void)userdata;
(void)data;
if(conn->connect_only)
if(conn->bits.connect_only)
connclose(conn, "Removing connect-only easy handle");
}

View file

@ -739,7 +739,7 @@ static bool url_match_connect_config(struct connectdata *conn,
struct url_conn_match *m)
{
/* connect-only or to-be-closed connections will not be reused */
if(conn->connect_only || conn->bits.close || conn->bits.no_reuse)
if(conn->bits.connect_only || conn->bits.close || conn->bits.no_reuse)
return FALSE;
/* ip_version must match */
@ -1402,7 +1402,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
conn->bits.ftp_use_eprt = data->set.ftp_use_eprt;
#endif
conn->ip_version = data->set.ipver;
conn->connect_only = (bool)data->set.connect_only;
conn->bits.connect_only = (bool)data->set.connect_only;
conn->transport_wanted = TRNSPRT_TCP; /* most of them are TCP streams */
/* Store the local bind parameters that will be used for this connection */

View file

@ -250,6 +250,7 @@ typedef enum {
* Boolean values that concerns this connection.
*/
struct ConnectBits {
BIT(connect_only);
#ifndef CURL_DISABLE_PROXY
BIT(httpproxy); /* if set, this transfer is done through an HTTP proxy */
BIT(socksproxy); /* if set, this transfer is done through a socks proxy */
@ -480,7 +481,6 @@ struct connectdata {
* 0 at start, then one of 09, 10, 11, etc. */
uint8_t httpversion_seen;
uint8_t gssapi_delegation; /* inherited from set.gssapi_delegation */
BIT(connect_only);
};
#ifndef CURL_DISABLE_PROXY

View file

@ -1138,7 +1138,8 @@ CURLcode Curl_gtls_ctx_init(struct gtls_ctx *gctx,
else {
infof(data, "SSL reusing session with ALPN '%s'",
scs->alpn ? scs->alpn : "-");
if(ssl_config->earlydata && scs->alpn && !cf->conn->connect_only) {
if(ssl_config->earlydata && scs->alpn &&
!cf->conn->bits.connect_only) {
bool do_early_data = FALSE;
if(sess_reuse_cb) {
result = sess_reuse_cb(cf, data, &alpns, scs, &do_early_data);

View file

@ -3411,7 +3411,7 @@ ossl_init_session_and_alpns(struct ossl_ctx *octx,
#ifdef HAVE_OPENSSL_EARLYDATA
if(ssl_config->earlydata && scs->alpn &&
SSL_SESSION_get_max_early_data(ssl_session) &&
!cf->conn->connect_only &&
!cf->conn->bits.connect_only &&
(SSL_version(octx->ssl) == TLS1_3_VERSION)) {
bool do_early_data = FALSE;
if(sess_reuse_cb) {

View file

@ -549,7 +549,7 @@ wssl_setup_session(struct Curl_cfilter *cf,
infof(data, "SSL reusing session with ALPN '%s'",
scs->alpn ? scs->alpn : "-");
if(ssl_config->earlydata &&
!cf->conn->connect_only &&
!cf->conn->bits.connect_only &&
!strcmp("TLSv1.3", wolfSSL_get_version(wss->ssl))) {
bool do_early_data = FALSE;
if(sess_reuse_cb) {