mirror of
https://github.com/curl/curl.git
synced 2026-05-17 16:36:21 +03:00
connect: Try all addresses in first connection attempt
Fixes a bug when all addresses in the first family fail immediately, due to "Network unreachable" for example, curl would hang and never try the next address family. Iterate through all address families when to trying establish the first connection attempt. Bug: http://curl.haxx.se/bug/view.cgi?id=1315 Reported-by: Michal Górny and Anthony G. Basile
This commit is contained in:
parent
28dd47d4d4
commit
4e1ece2e44
1 changed files with 6 additions and 6 deletions
|
|
@ -1104,12 +1104,12 @@ CURLcode Curl_connecthost(struct connectdata *conn, /* context */
|
|||
conn->tempaddr[0]->ai_next == NULL ? timeout_ms : timeout_ms / 2;
|
||||
|
||||
/* start connecting to first IP */
|
||||
res = singleipconnect(conn, conn->tempaddr[0], &(conn->tempsock[0]));
|
||||
while(res != CURLE_OK &&
|
||||
conn->tempaddr[0] &&
|
||||
conn->tempaddr[0]->ai_next &&
|
||||
conn->tempsock[0] == CURL_SOCKET_BAD)
|
||||
res = trynextip(conn, FIRSTSOCKET, 0);
|
||||
while(conn->tempaddr[0]) {
|
||||
res = singleipconnect(conn, conn->tempaddr[0], &(conn->tempsock[0]));
|
||||
if(res == CURLE_OK)
|
||||
break;
|
||||
conn->tempaddr[0] = conn->tempaddr[0]->ai_next;
|
||||
}
|
||||
|
||||
if(conn->tempsock[0] == CURL_SOCKET_BAD)
|
||||
return res;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue