diff options
author | Steve Holme <steve_holme@hotmail.com> | 2013-11-03 11:27:12 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2013-11-03 11:27:12 +0000 |
commit | 5094bb53f4a02726fb2aa93d0614e20430004be5 (patch) | |
tree | ef7fd08bd49a45defda62d90449697fc8a42e0a1 | |
parent | 052f24c9b7016bcb5fe3a751efb944928e1fb138 (diff) |
connect: Fixed "Whut?" no server connection failures
Introduced in commit 7d7df831981fee curl would loop displaying "Whut?"
if it was trying to connect to an address and port that didn't have
anything listening on it.
-rw-r--r-- | lib/connect.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/lib/connect.c b/lib/connect.c index 2cf1fc051..fe41fd128 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -742,16 +742,14 @@ CURLcode Curl_is_connected(struct connectdata *conn, /* check socket for connect */ result = Curl_socket_ready(CURL_SOCKET_BAD, conn->tempsock[i], 0); - switch(result) { - case 0: /* no connection yet */ + if(result == 0) { /* no connection yet */ if(curlx_tvdiff(now, conn->connecttime) >= conn->timeoutms_per_addr) { infof(data, "After %ldms connect time, move on!\n", conn->timeoutms_per_addr); error = ETIMEDOUT; } - break; - - case CURL_CSELECT_OUT: + } + else if(result == CURL_CSELECT_OUT) { if(verifyconnect(conn->tempsock[i], &error)) { /* we are connected with TCP, awesome! */ int other = i ^ 1; @@ -786,16 +784,9 @@ CURLcode Curl_is_connected(struct connectdata *conn, } else infof(data, "Connection failed\n"); - break; - - case CURL_CSELECT_ERR|CURL_CSELECT_OUT: - (void)verifyconnect(conn->tempsock[i], &error); - break; - - default: - infof(data, "Whut?\n"); - return CURLE_OK; } + else if((result & CURL_CSELECT_ERR) == CURL_CSELECT_ERR) + (void)verifyconnect(conn->tempsock[i], &error); /* * The connection failed here, we should attempt to connect to the "next @@ -821,6 +812,7 @@ CURLcode Curl_is_connected(struct connectdata *conn, failf(data, "Failed to connect to %s port %ld: %s", conn->host.name, conn->port, Curl_strerror(conn, error)); } + return code; } |