aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}
}