aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/asyn-ares.c26
-rw-r--r--lib/asyn-thread.c10
2 files changed, 18 insertions, 18 deletions
diff --git a/lib/asyn-ares.c b/lib/asyn-ares.c
index b76e66548..aa28c7820 100644
--- a/lib/asyn-ares.c
+++ b/lib/asyn-ares.c
@@ -352,8 +352,8 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
conn->async.os_specific;
CURLcode result = CURLE_OK;
- if(dns)
- *dns = NULL;
+ DEBUGASSERT(dns);
+ *dns = NULL;
waitperform(conn, 0);
@@ -381,19 +381,18 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
}
if(res && !res->num_pending) {
- if(dns) {
- (void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
- /* temp_ai ownership is moved to the connection, so we need not free-up
- them */
- res->temp_ai = NULL;
- }
+ (void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
+ /* temp_ai ownership is moved to the connection, so we need not free-up
+ them */
+ res->temp_ai = NULL;
+
if(!conn->async.dns) {
failf(data, "Could not resolve: %s (%s)",
conn->async.hostname, ares_strerror(conn->async.status));
result = conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
CURLE_COULDNT_RESOLVE_HOST;
}
- else if(dns)
+ else
*dns = conn->async.dns;
destroy_async_data(&conn->async);
@@ -408,7 +407,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
* Waits for a resolve to finish. This function should be avoided since using
* this risk getting the multi interface to "hang".
*
- * If 'entry' is non-NULL, make it point to the resolved dns entry
+ * 'entry' MUST be non-NULL.
*
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
@@ -420,10 +419,9 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
struct Curl_easy *data = conn->data;
timediff_t timeout;
struct curltime now = Curl_now();
- struct Curl_dns_entry *temp_entry;
- if(entry)
- *entry = NULL; /* clear on entry */
+ DEBUGASSERT(entry);
+ *entry = NULL; /* clear on entry */
timeout = Curl_timeleft(data, &now, TRUE);
if(timeout < 0) {
@@ -456,7 +454,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
timeout_ms = 1000;
waitperform(conn, timeout_ms);
- result = Curl_resolver_is_resolved(conn, entry?&temp_entry:NULL);
+ result = Curl_resolver_is_resolved(conn, entry);
if(result || conn->async.done)
break;
diff --git a/lib/asyn-thread.c b/lib/asyn-thread.c
index 6f63ce833..2138eb5cf 100644
--- a/lib/asyn-thread.c
+++ b/lib/asyn-thread.c
@@ -509,6 +509,9 @@ static CURLcode resolver_error(struct connectdata *conn)
return result;
}
+/*
+ * 'entry' may be NULL and then no data is returned
+ */
static CURLcode thread_wait_resolv(struct connectdata *conn,
struct Curl_dns_entry **entry,
bool report)
@@ -593,8 +596,8 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
struct thread_data *td = (struct thread_data*) conn->async.os_specific;
int done = 0;
- if(entry)
- *entry = NULL;
+ DEBUGASSERT(entry);
+ *entry = NULL;
if(!td) {
DEBUGASSERT(td);
@@ -614,8 +617,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
return result;
}
destroy_async_data(&conn->async);
- if(entry)
- *entry = conn->async.dns;
+ *entry = conn->async.dns;
}
else {
/* poll for name lookup done with exponential backoff up to 250ms */