aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Larrosa <larrosa@kde.org>2016-05-05 19:50:15 +0200
committerDaniel Stenberg <daniel@haxx.se>2016-05-08 14:29:26 +0200
commitae8f6620726c51aaf69f92a846fae63e74c9fab2 (patch)
tree1b23d433291e4fa23ddef4dceb18673ceaaa0793
parentbefa21f2cdefd3094a5ae407099d616d1f24fa4d (diff)
connect: fix invalid "Network is unreachable" errors
Sometimes, in systems with both ipv4 and ipv6 addresses but where the network doesn't support ipv6, Curl_is_connected returns an error (intermittently) even if the ipv4 socket connects successfully. This happens because there's a for-loop that iterates on the sockets but the error variable is not resetted when the ipv4 is checked and is ok. This patch fixes this problem by setting error to 0 when checking the second socket and not having a result yet. Fixes #794
-rw-r--r--lib/connect.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/connect.c b/lib/connect.c
index 8dfe9e2bf..ac2f26833 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -764,6 +764,7 @@ CURLcode Curl_is_connected(struct connectdata *conn,
rc = Curl_socket_ready(CURL_SOCKET_BAD, conn->tempsock[i], 0);
if(rc == 0) { /* no connection yet */
+ error = 0;
if(curlx_tvdiff(now, conn->connecttime) >= conn->timeoutms_per_addr) {
infof(data, "After %ldms connect time, move on!\n",
conn->timeoutms_per_addr);