1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Fixed multiple IP connects with the multi interface. This fix is influenced

by Gisle Vanem's patch, only modified by me.
This commit is contained in:
Daniel Stenberg 2004-08-04 12:38:01 +00:00
parent de6ab3de22
commit 55e61c092e

View File

@ -432,7 +432,6 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
more address exists */ more address exists */
static bool trynextip(struct connectdata *conn, static bool trynextip(struct connectdata *conn,
int sockindex, int sockindex,
long timeout,
bool *connected) bool *connected)
{ {
curl_socket_t sockfd; curl_socket_t sockfd;
@ -441,13 +440,15 @@ static bool trynextip(struct connectdata *conn,
if(sockindex != FIRSTSOCKET) if(sockindex != FIRSTSOCKET)
return TRUE; /* no next */ return TRUE; /* no next */
/* try the next address */
ai = conn->ip_addr->ai_next; ai = conn->ip_addr->ai_next;
while (ai) { while (ai) {
sockfd = singleipconnect(conn, ai, timeout, connected); sockfd = singleipconnect(conn, ai, 0L, connected);
if(sockfd != CURL_SOCKET_BAD) { if(sockfd != CURL_SOCKET_BAD) {
/* store the new socket descriptor */ /* store the new socket descriptor */
conn->sock[sockindex] = sockfd; conn->sock[sockindex] = sockfd;
conn->ip_addr = ai;
return FALSE; return FALSE;
} }
ai = ai->ai_next; ai = ai->ai_next;
@ -514,14 +515,14 @@ CURLcode Curl_is_connected(struct connectdata *conn,
} }
/* nope, not connected for real */ /* nope, not connected for real */
infof(data, "Connection failed\n"); infof(data, "Connection failed\n");
if(trynextip(conn, sockindex, allow-has_passed, connected)) { if(trynextip(conn, sockindex, connected)) {
code = CURLE_COULDNT_CONNECT; code = CURLE_COULDNT_CONNECT;
} }
} }
else if(WAITCONN_TIMEOUT != rc) { else if(WAITCONN_TIMEOUT != rc) {
/* nope, not connected */ /* nope, not connected */
infof(data, "Connection failed\n"); infof(data, "Connection failed\n");
if(trynextip(conn, sockindex, allow-has_passed, connected)) { if(trynextip(conn, sockindex, connected)) {
int error = Curl_ourerrno(); int error = Curl_ourerrno();
failf(data, "Failed connect to %s:%d; %s", failf(data, "Failed connect to %s:%d; %s",
conn->host.name, conn->port, Curl_strerror(conn,error)); conn->host.name, conn->port, Curl_strerror(conn,error));