summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-02-15 00:00:45 +0100
committerDaniel Stenberg <daniel@haxx.se>2020-02-15 00:00:45 +0100
commit16e48a16ba972ba998eddb0b3ca2ae84ed98496c (patch)
tree4016188d5c12ae6981512634aced984f8dd673cc
parentb26c92fbf04d2bc41a42f059f67ef2a5dc75cc62 (diff)
downloadcurl-bagder/ftp-sock-accepted.tar.gz
ftp: convert 'sock_accepted' to a plain booleanbagder/ftp-sock-accepted
This was an array indexed with sockindex but it was only ever used for the secondary socket.
-rw-r--r--lib/connect.c5
-rw-r--r--lib/ftp.c2
-rw-r--r--lib/urldata.h4
3 files changed, 5 insertions, 6 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 611d6d2f0..9baadb565 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -1428,12 +1428,11 @@ int Curl_closesocket(struct connectdata *conn,
curl_socket_t sock)
{
if(conn && conn->fclosesocket) {
- if((sock == conn->sock[SECONDARYSOCKET]) &&
- conn->sock_accepted[SECONDARYSOCKET])
+ if((sock == conn->sock[SECONDARYSOCKET]) && conn->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[SECONDARYSOCKET] = FALSE;
+ conn->sock_accepted = FALSE;
else {
int rc;
Curl_multi_closed(conn->data, sock);
diff --git a/lib/ftp.c b/lib/ftp.c
index c3efdc4e9..537fd82d1 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -291,7 +291,7 @@ static CURLcode AcceptServerConnect(struct connectdata *conn)
conn->sock[SECONDARYSOCKET] = s;
(void)curlx_nonblock(s, TRUE); /* enable non-blocking */
- conn->sock_accepted[SECONDARYSOCKET] = TRUE;
+ conn->sock_accepted = TRUE;
if(data->set.fsockopt) {
int error = 0;
diff --git a/lib/urldata.h b/lib/urldata.h
index e2afc6406..e1c3e181b 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -925,8 +925,6 @@ struct connectdata {
curl_socket_t sock[2]; /* two sockets, the second is used for the data
transfer when doing FTP */
curl_socket_t tempsock[2]; /* temporary sockets for happy eyeballs */
- bool sock_accepted[2]; /* TRUE if the socket on this index was created with
- accept() */
Curl_recv *recv[2];
Curl_send *send[2];
@@ -1081,6 +1079,8 @@ struct connectdata {
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() */
};
/* The end of connectdata. */