summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-05-26 14:42:47 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-05-26 14:42:47 +0200
commit69d25f60cea7cf4e2c7c67a3e2b9a1512c3a4117 (patch)
treec3be5ef8e71691b931ab36bca5dbbdfe4c60aaa8
parent96a822f6e2de3df00c94bd74a5981032678da70a (diff)
downloadcurl-bagder/conn-bits.tar.gz
urldata: connect related booleans live in struct ConnectBitsbagder/conn-bits
And remove a few unused booleans!
-rw-r--r--lib/connect.c12
-rw-r--r--lib/ftp.c3
-rw-r--r--lib/http.c2
-rw-r--r--lib/imap.c6
-rw-r--r--lib/pop3.c4
-rw-r--r--lib/smtp.c4
-rw-r--r--lib/url.c11
-rw-r--r--lib/urldata.h23
8 files changed, 29 insertions, 36 deletions
diff --git a/lib/connect.c b/lib/connect.c
index c53fb7106..8755fc73c 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -876,10 +876,10 @@ CURLcode Curl_is_connected(struct connectdata *conn,
return result;
}
/* should we try another protocol family? */
- if(i == 0 && !conn->parallel_connect &&
+ if(i == 0 && !conn->bits.parallel_connect &&
(Curl_timediff(now, conn->connecttime) >=
data->set.happy_eyeballs_timeout)) {
- conn->parallel_connect = TRUE; /* starting now */
+ conn->bits.parallel_connect = TRUE; /* starting now */
trynextip(conn, sockindex, 1);
}
continue;
@@ -905,10 +905,10 @@ CURLcode Curl_is_connected(struct connectdata *conn,
}
/* should we try another protocol family? */
- if(i == 0 && !conn->parallel_connect &&
+ if(i == 0 && !conn->bits.parallel_connect &&
(Curl_timediff(now, conn->connecttime) >=
data->set.happy_eyeballs_timeout)) {
- conn->parallel_connect = TRUE; /* starting now */
+ conn->bits.parallel_connect = TRUE; /* starting now */
trynextip(conn, sockindex, 1);
}
}
@@ -1452,11 +1452,11 @@ int Curl_closesocket(struct connectdata *conn,
curl_socket_t sock)
{
if(conn && conn->fclosesocket) {
- if((sock == conn->sock[SECONDARYSOCKET]) && conn->sock_accepted)
+ if((sock == conn->sock[SECONDARYSOCKET]) && conn->bits.sock_accepted)
/* if this socket matches the second socket, and that was created with
accept, then we MUST NOT call the callback but clear the accepted
status */
- conn->sock_accepted = FALSE;
+ conn->bits.sock_accepted = FALSE;
else {
int rc;
Curl_multi_closed(conn->data, sock);
diff --git a/lib/ftp.c b/lib/ftp.c
index 22bb4cd6c..2b439afd7 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -292,7 +292,7 @@ static CURLcode AcceptServerConnect(struct connectdata *conn)
conn->sock[SECONDARYSOCKET] = s;
(void)curlx_nonblock(s, TRUE); /* enable non-blocking */
- conn->sock_accepted = TRUE;
+ conn->bits.sock_accepted = TRUE;
if(data->set.fsockopt) {
int error = 0;
@@ -4340,7 +4340,6 @@ static CURLcode ftp_setup_connection(struct connectdata *conn)
char command;
*type = 0; /* it was in the middle of the hostname */
command = Curl_raw_toupper(type[6]);
- conn->bits.type_set = TRUE;
switch(command) {
case 'A': /* ASCII mode */
diff --git a/lib/http.c b/lib/http.c
index 345a78c43..5e019768c 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -2318,7 +2318,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
data->set.prefer_ascii ? 'a' : 'i');
}
}
- if(conn->bits.user_passwd && !conn->bits.userpwd_in_url)
+ if(conn->bits.user_passwd)
paste_ftp_userpwd = TRUE;
}
}
diff --git a/lib/imap.c b/lib/imap.c
index 66172bddc..14c76f08e 100644
--- a/lib/imap.c
+++ b/lib/imap.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -187,7 +187,7 @@ static void imap_to_imaps(struct connectdata *conn)
conn->handler = &Curl_handler_imaps;
/* Set the connection's upgraded to TLS flag */
- conn->tls_upgraded = TRUE;
+ conn->bits.tls_upgraded = TRUE;
}
#else
#define imap_to_imaps(x) Curl_nop_stmt
@@ -1710,7 +1710,7 @@ static CURLcode imap_setup_connection(struct connectdata *conn)
return result;
/* Clear the TLS upgraded flag */
- conn->tls_upgraded = FALSE;
+ conn->bits.tls_upgraded = FALSE;
return CURLE_OK;
}
diff --git a/lib/pop3.c b/lib/pop3.c
index 5459336d9..2f490b2f1 100644
--- a/lib/pop3.c
+++ b/lib/pop3.c
@@ -178,7 +178,7 @@ static void pop3_to_pop3s(struct connectdata *conn)
conn->handler = &Curl_handler_pop3s;
/* Set the connection's upgraded to TLS flag */
- conn->tls_upgraded = TRUE;
+ conn->bits.tls_upgraded = TRUE;
}
#else
#define pop3_to_pop3s(x) Curl_nop_stmt
@@ -1312,7 +1312,7 @@ static CURLcode pop3_setup_connection(struct connectdata *conn)
return result;
/* Clear the TLS upgraded flag */
- conn->tls_upgraded = FALSE;
+ conn->bits.tls_upgraded = FALSE;
return CURLE_OK;
}
diff --git a/lib/smtp.c b/lib/smtp.c
index bf65f246f..ec936480e 100644
--- a/lib/smtp.c
+++ b/lib/smtp.c
@@ -183,7 +183,7 @@ static void smtp_to_smtps(struct connectdata *conn)
conn->handler = &Curl_handler_smtps;
/* Set the connection's upgraded to TLS flag */
- conn->tls_upgraded = TRUE;
+ conn->bits.tls_upgraded = TRUE;
}
#else
#define smtp_to_smtps(x) Curl_nop_stmt
@@ -1617,7 +1617,7 @@ static CURLcode smtp_setup_connection(struct connectdata *conn)
CURLcode result;
/* Clear the TLS upgraded flag */
- conn->tls_upgraded = FALSE;
+ conn->bits.tls_upgraded = FALSE;
/* Initialise the SMTP layer */
result = smtp_init(conn);
diff --git a/lib/url.c b/lib/url.c
index 1913804c0..5114deaea 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1162,7 +1162,8 @@ ConnectionExists(struct Curl_easy *data,
continue;
if(strcmp(needle->unix_domain_socket, check->unix_domain_socket))
continue;
- if(needle->abstract_unix_socket != check->abstract_unix_socket)
+ if(needle->bits.abstract_unix_socket !=
+ check->bits.abstract_unix_socket)
continue;
}
else if(check->unix_domain_socket)
@@ -1173,7 +1174,7 @@ ConnectionExists(struct Curl_easy *data,
(check->handler->flags&PROTOPT_SSL))
/* don't do mixed SSL and non-SSL connections */
if(get_protocol_family(check->handler->protocol) !=
- needle->handler->protocol || !check->tls_upgraded)
+ needle->handler->protocol || !check->bits.tls_upgraded)
/* except protocols that have been upgraded via TLS */
continue;
@@ -1272,7 +1273,7 @@ ConnectionExists(struct Curl_easy *data,
if((strcasecompare(needle->handler->scheme, check->handler->scheme) ||
(get_protocol_family(check->handler->protocol) ==
- needle->handler->protocol && check->tls_upgraded)) &&
+ needle->handler->protocol && check->bits.tls_upgraded)) &&
(!needle->bits.conn_to_host || strcasecompare(
needle->conn_to_host.name, check->conn_to_host.name)) &&
(!needle->bits.conn_to_port ||
@@ -3164,7 +3165,7 @@ static CURLcode resolve_server(struct Curl_easy *data,
else {
bool longpath = FALSE;
hostaddr->addr = Curl_unix2addr(path, &longpath,
- conn->abstract_unix_socket);
+ conn->bits.abstract_unix_socket);
if(hostaddr->addr)
hostaddr->inuse++;
else {
@@ -3411,7 +3412,7 @@ static CURLcode create_conn(struct Curl_easy *data,
result = CURLE_OUT_OF_MEMORY;
goto out;
}
- conn->abstract_unix_socket = data->set.abstract_unix_socket;
+ conn->bits.abstract_unix_socket = data->set.abstract_unix_socket;
}
#endif
diff --git a/lib/urldata.h b/lib/urldata.h
index f31fd6df9..d13014494 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -468,18 +468,24 @@ struct ConnectBits {
BIT(ftp_use_data_ssl); /* Enabled SSL for the data connection */
#endif
BIT(netrc); /* name+password provided by netrc */
- BIT(userpwd_in_url); /* name+password found in url */
BIT(proxy_connect_closed); /* TRUE if a proxy disconnected the connection
in a CONNECT request with auth, so that
libcurl should reconnect and continue. */
BIT(bound); /* set true if bind() has already been done on this socket/
connection */
- BIT(type_set); /* type= was used in the URL */
BIT(multiplex); /* connection is multiplexed */
BIT(tcp_fastopen); /* use TCP Fast Open */
BIT(tls_enable_npn); /* TLS NPN extension? */
BIT(tls_enable_alpn); /* TLS ALPN extension? */
BIT(connect_only);
+#ifdef USE_UNIX_SOCKETS
+ BIT(abstract_unix_socket);
+#endif
+ BIT(tls_upgraded);
+ BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with
+ accept() */
+ BIT(parallel_connect); /* set TRUE when a parallel connect attempt has
+ started (happy eyeballs) */
};
struct hostname {
@@ -1093,20 +1099,7 @@ struct connectdata {
int retrycount; /* number of retries on a new connection */
#ifdef USE_UNIX_SOCKETS
char *unix_domain_socket;
- BIT(abstract_unix_socket);
#endif
- BIT(tls_upgraded);
- /* the two following *_inuse fields are only flags, not counters in any way.
- If TRUE it means the channel is in use, and if FALSE it means the channel
- is up for grabs by one. */
- BIT(readchannel_inuse); /* whether the read channel is in use by an easy
- handle */
- BIT(writechannel_inuse); /* whether the write channel is in use by an easy
- handle */
- BIT(sock_accepted); /* TRUE if the SECONDARYSOCKET was created with
- accept() */
- BIT(parallel_connect); /* set TRUE when a parallel connect attempt has
- started (happy eyeballs) */
};
/* The end of connectdata. */