asyn-ares: We prefer use of 'CURLcode result'

This commit is contained in:
Steve Holme 2014-12-14 16:19:59 +00:00
parent c98b50753f
commit 125f655131
1 changed files with 8 additions and 8 deletions

View File

@ -315,7 +315,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
struct ResolverResults *res = (struct ResolverResults *) struct ResolverResults *res = (struct ResolverResults *)
conn->async.os_specific; conn->async.os_specific;
CURLcode rc = CURLE_OK; CURLcode result = CURLE_OK;
*dns = NULL; *dns = NULL;
@ -329,7 +329,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
if(!conn->async.dns) { if(!conn->async.dns) {
failf(data, "Could not resolve: %s (%s)", failf(data, "Could not resolve: %s (%s)",
conn->async.hostname, ares_strerror(conn->async.status)); conn->async.hostname, ares_strerror(conn->async.status));
rc = conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY: result = conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
CURLE_COULDNT_RESOLVE_HOST; CURLE_COULDNT_RESOLVE_HOST;
} }
else else
@ -338,7 +338,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
destroy_async_data(&conn->async); destroy_async_data(&conn->async);
} }
return rc; return result;
} }
/* /*
@ -355,7 +355,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
struct Curl_dns_entry **entry) struct Curl_dns_entry **entry)
{ {
CURLcode rc=CURLE_OK; CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data; struct SessionHandle *data = conn->data;
long timeout; long timeout;
struct timeval now = Curl_tvnow(); struct timeval now = Curl_tvnow();
@ -394,7 +394,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
break; break;
if(Curl_pgrsUpdate(conn)) { if(Curl_pgrsUpdate(conn)) {
rc = CURLE_ABORTED_BY_CALLBACK; result = CURLE_ABORTED_BY_CALLBACK;
timeout = -1; /* trigger the cancel below */ timeout = -1; /* trigger the cancel below */
} }
else { else {
@ -403,6 +403,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
timeout -= timediff?timediff:1; /* always deduct at least 1 */ timeout -= timediff?timediff:1; /* always deduct at least 1 */
now = now2; /* for next loop */ now = now2; /* for next loop */
} }
if(timeout < 0) { if(timeout < 0) {
/* our timeout, so we cancel the ares operation */ /* our timeout, so we cancel the ares operation */
ares_cancel((ares_channel)data->state.resolver); ares_cancel((ares_channel)data->state.resolver);
@ -412,18 +413,17 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
/* Operation complete, if the lookup was successful we now have the entry /* Operation complete, if the lookup was successful we now have the entry
in the cache. */ in the cache. */
if(entry) if(entry)
*entry = conn->async.dns; *entry = conn->async.dns;
if(rc) if(result)
/* close the connection, since we can't return failure here without /* close the connection, since we can't return failure here without
cleaning up this connection properly. cleaning up this connection properly.
TODO: remove this action from here, it is not a name resolver decision. TODO: remove this action from here, it is not a name resolver decision.
*/ */
connclose(conn, "c-ares resolve failed"); connclose(conn, "c-ares resolve failed");
return rc; return result;
} }
/* Connects results to the list */ /* Connects results to the list */