Curl_addrinfo *addr = my_getaddrinfo(conn, hostname, port, &wait);
if (!addr) {
- if(wait)
+ if(wait) {
/* the response to our resolve call will come asynchronously at
a later time, good or bad */
- rc = 1;
+ /* First, check that we haven't received the info by now */
+ (void)Curl_is_resolved(conn, &dns);
+ if(dns)
+ rc = 0; /* pointer provided */
+ else
+ rc = 1; /* no info yet */
+ }
}
else
/* we got a response, store it in the cache */
}
/* called to check if the name is resolved now */
-CURLcode Curl_is_resolved(struct connectdata *conn, bool *done)
+CURLcode Curl_is_resolved(struct connectdata *conn,
+ struct Curl_dns_entry **dns)
{
fd_set read_fds, write_fds;
static const struct timeval tv={0,0};
if(count)
ares_process(data->state.areschannel, &read_fds, &write_fds);
- *done = FALSE;
+ *dns = NULL;
if(conn->async.done) {
if(!conn->async.dns)
return CURLE_COULDNT_RESOLVE_HOST;
- *done = TRUE;
+ *dns = conn->async.dns;
}
return CURLE_OK;
ares_gethostbyname(data->state.areschannel, hostname, PF_INET,
host_callback, conn);
- *waitp = TRUE; /* please wait for the response */
+
+ *waitp = TRUE; /* please wait for the response */
}
else
ares_destroy(data->state.areschannel);
return CURLE_OK;
}
-CURLcode Curl_is_resolved(struct connectdata *conn, bool *done)
+CURLcode Curl_is_resolved(struct connectdata *conn,
+ struct Curl_dns_entry **dns)
{
(void)conn;
- *done = TRUE;
+ *dns = NULL;
- return CURLE_OK;
+ return CURLE_COULDNT_RESOLVE_HOST;
}
#endif
int port,
struct Curl_dns_entry **dnsentry);
-CURLcode Curl_is_resolved(struct connectdata *conn, bool *done);
+CURLcode Curl_is_resolved(struct connectdata *conn,
+ struct Curl_dns_entry **dns);
CURLcode Curl_wait_for_resolv(struct connectdata *conn,
struct Curl_dns_entry **dnsentry);
CURLcode Curl_multi_ares_fdset(struct connectdata *conn,
case CURLM_STATE_WAITRESOLVE:
/* awaiting an asynch name resolve to complete */
{
- bool done;
+ struct Curl_dns_entry *dns;
/* check if we have the name resolved by now */
- easy->result = Curl_is_resolved(easy->easy_conn, &done);
+ easy->result = Curl_is_resolved(easy->easy_conn, &dns);
- if(done) {
+ if(dns) {
/* Perform the next step in the connection phase, and then move on
to the WAITCONNECT state */
easy->result = Curl_async_resolved(easy->easy_conn);