curl-library
bug in trynextip
Date: Wed, 21 Oct 2009 13:15:56 +0300
Hi,
Seems there is a bug in the next function from .\lib\connect.c :
------------------------------------------------------------------------------------
/* Used within the multi interface. Try next IP address, return TRUE if no
more address exists or error */
static bool trynextip(struct connectdata *conn,
int sockindex,
bool *connected)
{
curl_socket_t sockfd;
Curl_addrinfo *ai;
/* 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;
while(ai) {
sockfd = singleipconnect(conn, ai, 0L, connected);
if(sockfd != CURL_SOCKET_BAD) {
/* store the new socket descriptor */
conn->sock[sockindex] = sockfd;
conn->ip_addr = ai;
break;
}
ai = ai->ai_next;
}
return TRUE;
}
------------------------------------------------------------------------------------
It always returns TRUE, so even if we connected here
caller ( Curl_is_connected() for example ) will be notified
about error.
Next change resolve the problem:
.....
conn->sock[sockindex] = sockfd;
conn->ip_addr = ai;
return FALSE;
.....
Best regards,
Alexey Simak
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-10-21