diff options
author | Sterling Hughes <sterling@bumblebury.com> | 2002-01-07 20:52:32 +0000 |
---|---|---|
committer | Sterling Hughes <sterling@bumblebury.com> | 2002-01-07 20:52:32 +0000 |
commit | 8d7f402efbcace85851c6bb8f6aa2452c15a9595 (patch) | |
tree | 4faf3a7b90bca33494801df5e0b58415d3ff39c3 /lib/easy.c | |
parent | d3299beec734be02a781c393a994d525e3eaaac1 (diff) |
Make cach'ing work with threads now, there are now three cases:
- Use a global dns cache (via setting the tentatively named,
CURLOPT_DNS_USE_GLOBAL_CACHE option to true)
- Use a per-handle dns cache, by default
- Use a pooled dns cache when in the "multi" interface
Diffstat (limited to 'lib/easy.c')
-rw-r--r-- | lib/easy.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/easy.c b/lib/easy.c index c24eb9018..45de7e8d5 100644 --- a/lib/easy.c +++ b/lib/easy.c @@ -141,8 +141,6 @@ CURLcode curl_global_init(long flags) if (initialized) return CURLE_OK; - Curl_host_cache_init(); - if (flags & CURL_GLOBAL_SSL) Curl_SSL_init(); @@ -165,8 +163,8 @@ void curl_global_cleanup(void) if (!initialized) return; - Curl_host_cache_dtor(); - + Curl_global_host_cache_dtor(); + if (init_flags & CURL_GLOBAL_SSL) Curl_SSL_cleanup(); @@ -235,12 +233,24 @@ CURLcode curl_easy_perform(CURL *curl) { struct SessionHandle *data = (struct SessionHandle *)curl; + if (!data->hostcache) { + if (Curl_global_host_cache_use(data)) { + data->hostcache = Curl_global_host_cache_get(); + } + else { + data->hostcache = curl_hash_alloc(7, Curl_freeaddrinfo); + } + } + return Curl_perform(data); } void curl_easy_cleanup(CURL *curl) { struct SessionHandle *data = (struct SessionHandle *)curl; + if (!Curl_global_host_cache_use(data)) { + curl_hash_destroy(data->hostcache); + } Curl_close(data); } |