aboutsummaryrefslogtreecommitdiff
path: root/lib/connect.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2013-11-26 00:04:28 +0100
committerDaniel Stenberg <daniel@haxx.se>2013-11-27 22:26:43 +0100
commitb2a55c81061a9f5efcd16a49064410bc1a627720 (patch)
tree0ca0cd22036fb8390a5f310d1fe803b8f990f911 /lib/connect.c
parent030a2b8cb8c4f1d03af6f6e6a3aa3a5a1db5f5a7 (diff)
connect: Try next ip directly after immediate connect fail
This fixes a rare Happy Eyeballs bug where if the first IP family runs out of addresses before the second-family-timer fires, and the second IP family's first connect fails immediately, no further IPs of the second family are attempted.
Diffstat (limited to 'lib/connect.c')
-rw-r--r--lib/connect.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 3cbca1b50..9c38724d6 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -560,12 +560,19 @@ static CURLcode trynextip(struct connectdata *conn,
ai = conn->tempaddr[0]->ai_next;
}
- while(ai && ai->ai_family != family)
- ai = ai->ai_next;
-
- if(ai) {
- rc = singleipconnect(conn, ai, &conn->tempsock[tempindex]);
- conn->tempaddr[tempindex] = ai;
+ while(ai) {
+ while(ai && ai->ai_family != family)
+ ai = ai->ai_next;
+
+ if(ai) {
+ rc = singleipconnect(conn, ai, &conn->tempsock[tempindex]);
+ conn->tempaddr[tempindex] = ai;
+ if(rc == CURLE_COULDNT_CONNECT) {
+ ai = ai->ai_next;
+ continue;
+ }
+ }
+ break;
}
}