diff --git a/lib/connect.c b/lib/connect.c index b12cf8b84b544135cb172a690e3d029d5f9c62c0..a24a1217851616d049c61e18f1462d4e3f97696b 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -504,12 +504,13 @@ static bool trynextip(struct connectdata *conn, curl_socket_t sockfd; Curl_addrinfo *ai; - if(sockindex != FIRSTSOCKET) - return TRUE; /* no next */ - /* first close the failed socket */ sclose(conn->sock[sockindex]); conn->sock[sockindex] = CURL_SOCKET_BAD; + *connected = FALSE; + + if(sockindex != FIRSTSOCKET) + return TRUE; /* no next */ /* try the next address */ ai = conn->ip_addr->ai_next;