diff options
author | Kamil Dudka <kdudka@redhat.com> | 2015-02-16 17:16:57 +0100 |
---|---|---|
committer | Kamil Dudka <kdudka@redhat.com> | 2015-02-23 13:32:28 +0100 |
commit | e08a12dab1a410c94bf75aef04251bf64c127eb6 (patch) | |
tree | 9310dc9cf38b81f749ccad3f437730400f010978 /lib | |
parent | 92835ca5d87850ae0c670d66bd73af391b34cdc3 (diff) |
connect: wait for IPv4 connection attempts
... even if the last IPv6 connection attempt has failed.
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1187531#c4
Diffstat (limited to 'lib')
-rw-r--r-- | lib/connect.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/connect.c b/lib/connect.c index 61b180825..904d3c935 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -753,6 +753,7 @@ CURLcode Curl_is_connected(struct connectdata *conn, } for(i=0; i<2; i++) { + const int other = i ^ 1; if(conn->tempsock[i] == CURL_SOCKET_BAD) continue; @@ -782,7 +783,6 @@ CURLcode Curl_is_connected(struct connectdata *conn, else if(rc == CURL_CSELECT_OUT) { if(verifyconnect(conn->tempsock[i], &error)) { /* we are connected with TCP, awesome! */ - int other = i ^ 1; /* use this socket from now on */ conn->sock[sockindex] = conn->tempsock[i]; @@ -824,6 +824,7 @@ CURLcode Curl_is_connected(struct connectdata *conn, data->state.os_errno = error; SET_SOCKERRNO(error); if(conn->tempaddr[i]) { + CURLcode status; char ipaddress[MAX_IPADR_LEN]; Curl_printable_address(conn->tempaddr[i], ipaddress, MAX_IPADR_LEN); infof(data, "connect to %s port %ld failed: %s\n", @@ -832,7 +833,11 @@ CURLcode Curl_is_connected(struct connectdata *conn, conn->timeoutms_per_addr = conn->tempaddr[i]->ai_next == NULL ? allow : allow / 2; - result = trynextip(conn, sockindex, i); + status = trynextip(conn, sockindex, i); + if(status != CURLE_COULDNT_CONNECT + || conn->tempsock[other] == CURL_SOCKET_BAD) + /* the last attempt failed and no other sockets remain open */ + result = status; } } } |