mirror of
https://github.com/curl/curl.git
synced 2026-08-02 18:00:27 +03:00
Revert "urldata: move async resolver state from easy handle to connectdata"
This reverts commit 56a4db2e4e (#12198)
We want the c-ares channel to be held in the easy handle, not per
connection - for performance.
Closes #12524
This commit is contained in:
parent
9f2d2290d1
commit
907eea0804
11 changed files with 138 additions and 155 deletions
42
lib/url.c
42
lib/url.c
|
|
@ -298,6 +298,10 @@ CURLcode Curl_close(struct Curl_easy **datap)
|
|||
Curl_safefree(data->info.contenttype);
|
||||
Curl_safefree(data->info.wouldredirect);
|
||||
|
||||
/* this destroys the channel and we cannot use it anymore after this */
|
||||
Curl_resolver_cancel(data);
|
||||
Curl_resolver_cleanup(data->state.async.resolver);
|
||||
|
||||
data_priority_cleanup(data);
|
||||
|
||||
/* No longer a dirty share, if it exists */
|
||||
|
|
@ -514,6 +518,13 @@ CURLcode Curl_open(struct Curl_easy **curl)
|
|||
|
||||
data->magic = CURLEASY_MAGIC_NUMBER;
|
||||
|
||||
result = Curl_resolver_init(data, &data->state.async.resolver);
|
||||
if(result) {
|
||||
DEBUGF(fprintf(stderr, "Error: resolver_init failed\n"));
|
||||
free(data);
|
||||
return result;
|
||||
}
|
||||
|
||||
result = Curl_init_userdefined(data);
|
||||
if(!result) {
|
||||
Curl_dyn_init(&data->state.headerb, CURL_MAX_HTTP_HEADER);
|
||||
|
|
@ -530,6 +541,7 @@ CURLcode Curl_open(struct Curl_easy **curl)
|
|||
}
|
||||
|
||||
if(result) {
|
||||
Curl_resolver_cleanup(data->state.async.resolver);
|
||||
Curl_dyn_free(&data->state.headerb);
|
||||
Curl_freeset(data);
|
||||
free(data);
|
||||
|
|
@ -563,7 +575,6 @@ static void conn_free(struct Curl_easy *data, struct connectdata *conn)
|
|||
Curl_conn_cf_discard_all(data, conn, (int)i);
|
||||
}
|
||||
|
||||
Curl_resolver_cleanup(conn->resolve_async.resolver);
|
||||
Curl_free_idnconverted_hostname(&conn->host);
|
||||
Curl_free_idnconverted_hostname(&conn->conn_to_host);
|
||||
#ifndef CURL_DISABLE_PROXY
|
||||
|
|
@ -663,7 +674,6 @@ void Curl_disconnect(struct Curl_easy *data,
|
|||
conn->handler->disconnect(data, conn, dead_connection);
|
||||
|
||||
conn_shutdown(data);
|
||||
Curl_resolver_cancel(data);
|
||||
|
||||
/* detach it again */
|
||||
Curl_detach_connection(data);
|
||||
|
|
@ -3740,35 +3750,7 @@ static CURLcode create_conn(struct Curl_easy *data,
|
|||
goto out;
|
||||
}
|
||||
|
||||
result = Curl_resolver_init(data, &conn->resolve_async.resolver);
|
||||
if(result) {
|
||||
DEBUGF(fprintf(stderr, "Error: resolver_init failed\n"));
|
||||
goto out;
|
||||
}
|
||||
|
||||
Curl_attach_connection(data, conn);
|
||||
|
||||
#ifdef USE_ARES
|
||||
result = Curl_set_dns_servers(data, data->set.str[STRING_DNS_SERVERS]);
|
||||
if(result && result != CURLE_NOT_BUILT_IN)
|
||||
goto out;
|
||||
|
||||
result = Curl_set_dns_interface(data,
|
||||
data->set.str[STRING_DNS_INTERFACE]);
|
||||
if(result && result != CURLE_NOT_BUILT_IN)
|
||||
goto out;
|
||||
|
||||
result = Curl_set_dns_local_ip4(data,
|
||||
data->set.str[STRING_DNS_LOCAL_IP4]);
|
||||
if(result && result != CURLE_NOT_BUILT_IN)
|
||||
goto out;
|
||||
|
||||
result = Curl_set_dns_local_ip6(data,
|
||||
data->set.str[STRING_DNS_LOCAL_IP6]);
|
||||
if(result && result != CURLE_NOT_BUILT_IN)
|
||||
goto out;
|
||||
#endif /* USE_ARES */
|
||||
|
||||
result = Curl_conncache_add_conn(data);
|
||||
if(result)
|
||||
goto out;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue