Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ftp: convert 'sock_accepted' to a plain boolean #4929

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/connect.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/ftp.c
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/urldata.h
Expand Up @@ -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];

Expand Down Expand Up @@ -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. */
Expand Down