mirror of
https://github.com/moparisthebest/curl
synced 2024-11-12 12:35:04 -05:00
asyn-*: remove support for never-used NULL entry pointers
... and instead convert those to asserts to make sure they are truly never NULL. Closes #5324
This commit is contained in:
parent
f7ab488570
commit
59e351a572
@ -352,8 +352,8 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
|
|||||||
conn->async.os_specific;
|
conn->async.os_specific;
|
||||||
CURLcode result = CURLE_OK;
|
CURLcode result = CURLE_OK;
|
||||||
|
|
||||||
if(dns)
|
DEBUGASSERT(dns);
|
||||||
*dns = NULL;
|
*dns = NULL;
|
||||||
|
|
||||||
waitperform(conn, 0);
|
waitperform(conn, 0);
|
||||||
|
|
||||||
@ -381,19 +381,18 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(res && !res->num_pending) {
|
if(res && !res->num_pending) {
|
||||||
if(dns) {
|
(void)Curl_addrinfo_callback(conn, res->last_status, res->temp_ai);
|
||||||
(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
|
||||||
/* temp_ai ownership is moved to the connection, so we need not free-up
|
them */
|
||||||
them */
|
res->temp_ai = NULL;
|
||||||
res->temp_ai = NULL;
|
|
||||||
}
|
|
||||||
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));
|
||||||
result = conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
|
result = conn->bits.proxy?CURLE_COULDNT_RESOLVE_PROXY:
|
||||||
CURLE_COULDNT_RESOLVE_HOST;
|
CURLE_COULDNT_RESOLVE_HOST;
|
||||||
}
|
}
|
||||||
else if(dns)
|
else
|
||||||
*dns = conn->async.dns;
|
*dns = conn->async.dns;
|
||||||
|
|
||||||
destroy_async_data(&conn->async);
|
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
|
* Waits for a resolve to finish. This function should be avoided since using
|
||||||
* this risk getting the multi interface to "hang".
|
* 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,
|
* Returns CURLE_COULDNT_RESOLVE_HOST if the host was not resolved,
|
||||||
* CURLE_OPERATION_TIMEDOUT if a time-out occurred, or other errors.
|
* 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;
|
struct Curl_easy *data = conn->data;
|
||||||
timediff_t timeout;
|
timediff_t timeout;
|
||||||
struct curltime now = Curl_now();
|
struct curltime now = Curl_now();
|
||||||
struct Curl_dns_entry *temp_entry;
|
|
||||||
|
|
||||||
if(entry)
|
DEBUGASSERT(entry);
|
||||||
*entry = NULL; /* clear on entry */
|
*entry = NULL; /* clear on entry */
|
||||||
|
|
||||||
timeout = Curl_timeleft(data, &now, TRUE);
|
timeout = Curl_timeleft(data, &now, TRUE);
|
||||||
if(timeout < 0) {
|
if(timeout < 0) {
|
||||||
@ -456,7 +454,7 @@ CURLcode Curl_resolver_wait_resolv(struct connectdata *conn,
|
|||||||
timeout_ms = 1000;
|
timeout_ms = 1000;
|
||||||
|
|
||||||
waitperform(conn, timeout_ms);
|
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)
|
if(result || conn->async.done)
|
||||||
break;
|
break;
|
||||||
|
@ -509,6 +509,9 @@ static CURLcode resolver_error(struct connectdata *conn)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 'entry' may be NULL and then no data is returned
|
||||||
|
*/
|
||||||
static CURLcode thread_wait_resolv(struct connectdata *conn,
|
static CURLcode thread_wait_resolv(struct connectdata *conn,
|
||||||
struct Curl_dns_entry **entry,
|
struct Curl_dns_entry **entry,
|
||||||
bool report)
|
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;
|
struct thread_data *td = (struct thread_data*) conn->async.os_specific;
|
||||||
int done = 0;
|
int done = 0;
|
||||||
|
|
||||||
if(entry)
|
DEBUGASSERT(entry);
|
||||||
*entry = NULL;
|
*entry = NULL;
|
||||||
|
|
||||||
if(!td) {
|
if(!td) {
|
||||||
DEBUGASSERT(td);
|
DEBUGASSERT(td);
|
||||||
@ -614,8 +617,7 @@ CURLcode Curl_resolver_is_resolved(struct connectdata *conn,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
destroy_async_data(&conn->async);
|
destroy_async_data(&conn->async);
|
||||||
if(entry)
|
*entry = conn->async.dns;
|
||||||
*entry = conn->async.dns;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* poll for name lookup done with exponential backoff up to 250ms */
|
/* poll for name lookup done with exponential backoff up to 250ms */
|
||||||
|
Loading…
Reference in New Issue
Block a user