aboutsummaryrefslogtreecommitdiff
path: root/lib/ftp.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2013-10-29 11:51:25 +0100
committerDaniel Stenberg <daniel@haxx.se>2013-11-04 22:38:19 +0100
commit02fbc26d59c59170fd358034b04a43d8e9b7c78f (patch)
tree99f9688582ca5abdb78dbb8fb2c065bd9a6d2f97 /lib/ftp.c
parent0074c9f5d12e84ed877647e78fcf77460a9270e5 (diff)
connect: Add connection delay to Happy Eyeballs.
This patch adds a 200ms delay between the first and second address family socket connection attempts. It also iterates over IP addresses in the order returned by the system, meaning most dual-stack systems will try IPv6 first. Additionally, it refactors the connect code, removing most code that handled synchronous connects. Since all sockets are now non-blocking, the logic can be made simpler.
Diffstat (limited to 'lib/ftp.c')
-rw-r--r--lib/ftp.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/lib/ftp.c b/lib/ftp.c
index 46ec8a6f6..8879ff1d9 100644
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1884,7 +1884,6 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
struct Curl_dns_entry *addr=NULL;
int rc;
unsigned short connectport; /* the local port connect() should use! */
- bool connected;
char *str=&data->state.buffer[4]; /* start on the first letter */
if((ftpc->count1 == 0) &&
@@ -2038,9 +2037,8 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
}
}
- result = Curl_connecthost(conn,
- addr,
- &connected);
+ conn->bits.tcpconnect[SECONDARYSOCKET] = FALSE;
+ result = Curl_connecthost(conn, addr);
Curl_resolv_unlock(data, addr); /* we're done using this address */
@@ -2051,7 +2049,6 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
return result;
}
- conn->bits.tcpconnect[SECONDARYSOCKET] = connected;
/*
* When this is used from the multi interface, this might've returned with
@@ -2063,15 +2060,6 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
/* this just dumps information about this second connection */
ftp_pasv_verbose(conn, conn->ip_addr, ftpc->newhost, connectport);
- if(connected) {
- /* Only do the proxy connection magic if we're actually connected. We do
- this little trick and send in the same 'connected' variable here again
- and it will be set FALSE by proxy_magic() for when for example the
- CONNECT procedure doesn't complete */
- infof(data, "Connection to proxy confirmed almost instantly\n");
- result = proxy_magic(conn, ftpc->newhost, ftpc->newport, &connected);
- }
- conn->bits.tcpconnect[SECONDARYSOCKET] = connected;
conn->bits.do_more = TRUE;
state(conn, FTP_STOP); /* this phase is completed */