diff options
author | Anders Bakken <agbakken@gmail.com> | 2018-01-30 16:33:51 -0800 |
---|---|---|
committer | Jay Satiro <raysatiro@yahoo.com> | 2018-02-20 04:24:28 -0500 |
commit | 50d1b3379a818df00c6382d68e2e39977cc96cd6 (patch) | |
tree | e792d9a61262b0ac547fd5b301c0150dbc3c7417 /lib/connect.c | |
parent | e77f0e5a5a8161f103d8fbd3ed335345703c6e1f (diff) | |
download | curl-50d1b3379a818df00c6382d68e2e39977cc96cd6.tar.gz |
CURLOPT_RESOLVE: Add support for multiple IP addresses per entry
This enables users to preresolve but still take advantage of happy
eyeballs and trying multiple addresses if some are not connecting.
Ref: https://github.com/curl/curl/pull/2260
Diffstat (limited to 'lib/connect.c')
-rw-r--r-- | lib/connect.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/connect.c b/lib/connect.c index d56cf2f16..c3add43cc 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -619,8 +619,8 @@ void Curl_persistconninfo(struct connectdata *conn) /* retrieves ip address and port from a sockaddr structure. note it calls Curl_inet_ntop which sets errno on fail, not SOCKERRNO. */ -static bool getaddressinfo(struct sockaddr *sa, char *addr, - long *port) +bool Curl_getaddressinfo(struct sockaddr *sa, char *addr, + long *port) { unsigned short us_port; struct sockaddr_in *si = NULL; @@ -700,16 +700,16 @@ void Curl_updateconninfo(struct connectdata *conn, curl_socket_t sockfd) return; } - if(!getaddressinfo((struct sockaddr*)&ssrem, - conn->primary_ip, &conn->primary_port)) { + if(!Curl_getaddressinfo((struct sockaddr*)&ssrem, + conn->primary_ip, &conn->primary_port)) { failf(data, "ssrem inet_ntop() failed with errno %d: %s", errno, Curl_strerror(conn, errno)); return; } memcpy(conn->ip_addr_str, conn->primary_ip, MAX_IPADR_LEN); - if(!getaddressinfo((struct sockaddr*)&ssloc, - conn->local_ip, &conn->local_port)) { + if(!Curl_getaddressinfo((struct sockaddr*)&ssloc, + conn->local_ip, &conn->local_port)) { failf(data, "ssloc inet_ntop() failed with errno %d: %s", errno, Curl_strerror(conn, errno)); return; @@ -1005,8 +1005,8 @@ static CURLcode singleipconnect(struct connectdata *conn, return CURLE_OK; /* store remote address and port used in this connection attempt */ - if(!getaddressinfo((struct sockaddr*)&addr.sa_addr, - ipaddress, &port)) { + if(!Curl_getaddressinfo((struct sockaddr*)&addr.sa_addr, + ipaddress, &port)) { /* malformed address or bug in inet_ntop, try next address */ failf(data, "sa_addr inet_ntop() failed with errno %d: %s", errno, Curl_strerror(conn, errno)); |