summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-05-15 00:40:25 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-05-15 00:40:25 +0200
commit88288ae015ee605ae1b3cb72c82f78f5dfa90fa6 (patch)
treeb092d14afed124b48f89c126b1fa44739e37ddd4
parent8ad506851ea6d7f772b3d5d6e31d7b2b2fb0d09d (diff)
downloadcurl-bagder/ftp-close-down-secondary-ssl.tar.gz
ftp: make domore_getsock() return the secondary socket properlybagder/ftp-close-down-secondary-ssl
Previously, after PASV and immediately after the data connection has connected, the function would only return the control socket to wait for which then made the data connection simply timeout and not get polled correctly. This become obvious when running test 1631 and 1632 event- based.
-rw-r--r--lib/ftp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 289dab259..c8c7968bb 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -816,6 +816,7 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks)
if(FTP_STOP == ftpc->state) {
int bits = GETSOCK_READSOCK(0);
+ bool any = FALSE;
/* if stopped and still in this state, then we're also waiting for a
connect on the secondary connection */
@@ -830,10 +831,11 @@ static int ftp_domore_getsock(struct connectdata *conn, curl_socket_t *socks)
if(conn->tempsock[i] != CURL_SOCKET_BAD) {
socks[s] = conn->tempsock[i];
bits |= GETSOCK_WRITESOCK(s++);
+ any = TRUE;
}
}
}
- else {
+ if(!any) {
socks[1] = conn->sock[SECONDARYSOCKET];
bits |= GETSOCK_WRITESOCK(1) | GETSOCK_READSOCK(1);
}