From 7d7df831981feebdbfeb21c12d6c068312a6e4b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Sat, 26 Oct 2013 14:17:33 +0200 Subject: Add "Happy Eyeballs" for IPv4/IPv6. This patch invokes two socket connect()s nearly simultaneously, and the socket that is first connected "wins" and is subsequently used for the connection. The other is terminated. There is a very slight IPv4 preference, in that if both sockets connect simultaneously IPv4 is checked first and thus will win. --- lib/ftp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/ftp.c') diff --git a/lib/ftp.c b/lib/ftp.c index e66a8a808..46ec8a6f6 100644 --- a/lib/ftp.c +++ b/lib/ftp.c @@ -1881,7 +1881,6 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, struct ftp_conn *ftpc = &conn->proto.ftpc; CURLcode result; struct SessionHandle *data=conn->data; - Curl_addrinfo *conninfo; struct Curl_dns_entry *addr=NULL; int rc; unsigned short connectport; /* the local port connect() should use! */ @@ -2041,8 +2040,6 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, result = Curl_connecthost(conn, addr, - &conn->sock[SECONDARYSOCKET], - &conninfo, &connected); Curl_resolv_unlock(data, addr); /* we're done using this address */ @@ -2064,7 +2061,7 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, if(data->set.verbose) /* this just dumps information about this second connection */ - ftp_pasv_verbose(conn, conninfo, ftpc->newhost, connectport); + 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 -- cgit v1.2.3