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/multi.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/multi.c')
-rw-r--r-- | lib/multi.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/multi.c b/lib/multi.c index b7ab209f5..bfd3949cb 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -82,7 +82,8 @@ struct Curl_multi { struct Curl_message *msgs; /* amount of messages in the queue */ int num_msgs; - + /* Hostname cache */ + curl_hash *hostcache; }; @@ -244,7 +245,6 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) easy=multi->easy.next; while(easy) { - switch(easy->state) { case CURLM_STATE_INIT: /* init this transfer. */ @@ -256,6 +256,17 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) } break; case CURLM_STATE_CONNECT: + if (Curl_global_host_cache_use(easy->easy_handle)) { + easy->easy_handle->hostcache = Curl_global_host_cache_get(); + } + else { + if (multi->hostcache == NULL) { + multi->hostcache = curl_hash_alloc(7, Curl_freeaddrinfo); + } + + easy->easy_handle->hostcache = multi->hostcache; + } + /* Connect. We get a connection identifier filled in. */ easy->result = Curl_connect(easy->easy_handle, &easy->easy_conn); @@ -328,7 +339,7 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) struct Curl_multi *multi=(struct Curl_multi *)multi_handle; if(GOOD_MULTI_HANDLE(multi)) { multi->type = 0; /* not good anymore */ - + curl_hash_destroy(multi->hostcache); /* remove all easy handles */ free(multi); @@ -341,3 +352,10 @@ CURLMcode curl_multi_cleanup(CURLM *multi_handle) CURLMsg *curl_multi_info_read(CURLM *multi_handle, int *msgs_in_queue); +/* + * local variables: + * eval: (load-file "../curl-mode.el") + * end: + * vim600: fdm=marker + * vim: et sw=2 ts=2 sts=2 tw=78 + */ |