Commit 56f17d2c authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

I made the torture test on test 530 go through. This was actually due to

silly code left from when we switched to let the multi handle "hold" the dns
cache when using the multi interface... Of course this only triggered when a
certain function call returned error at the correct moment.
parent 19ae96f4
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -6,6 +6,12 @@

                                  Changelog

Daniel S (15 Jan 2008)
- I made the torture test on test 530 go through. This was actually due to
  silly code left from when we switched to let the multi handle "hold" the dns
  cache when using the multi interface... Of course this only triggered when a
  certain function call returned error at the correct moment.

Daniel S (14 Jan 2008)
- Joe Malicki filed bug report #1871269
  (http://curl.haxx.se/bug/view.cgi?id=1871269) and we could fix his hang-
+7 −0
Original line number Diff line number Diff line
@@ -103,6 +103,7 @@
 15.3 size_t
 15.4 remove several functions
 15.5 remove CURLOPT_FAILONERROR
 15.6 remove CURLOPT_DNS_USE_GLOBAL_CACHE

==============================================================================

@@ -563,3 +564,9 @@ to provide the data to send.

 Remove support for CURLOPT_FAILONERROR, it has gotten too kludgy and weird
 internally. Let the app judge success or not for itself.

15.6 remove CURLOPT_DNS_USE_GLOBAL_CACHE

 Remove support for a global DNS cache. Anything global is silly, and we
 already offer the share interface for the same functionality but done
 "right".
+10 −5
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -127,14 +127,19 @@ static void freednsentry(void *freethis);
 * Curl_global_host_cache_init() initializes and sets up a global DNS cache.
 * Global DNS cache is general badness. Do not use. This will be removed in
 * a future version. Use the share interface instead!
 *
 * Returns 0 on success, 1 on failure.
 */
void Curl_global_host_cache_init(void)
int Curl_global_host_cache_init(void)
{
  int rc = 0;
  if(!host_cache_initialized) {
    Curl_hash_init(&hostname_cache, 7, Curl_hash_str, Curl_str_key_compare,
                   freednsentry);
    rc = Curl_hash_init(&hostname_cache, 7, Curl_hash_str,
                        Curl_str_key_compare, freednsentry);
    if(!rc)
      host_cache_initialized = 1;
  }
  return rc;
}

/*
+11 −3
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
 *                            | (__| |_| |  _ <| |___
 *                             \___|\___/|_| \_\_____|
 *
 * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
 * Copyright (C) 1998 - 2008, Daniel Stenberg, <daniel@haxx.se>, et al.
 *
 * This software is licensed as described in the file COPYING, which
 * you should have received as part of this distribution. The terms
@@ -125,11 +125,19 @@ struct hostent;
struct SessionHandle;
struct connectdata;

void Curl_global_host_cache_init(void);
/*
 * Curl_global_host_cache_init() initializes and sets up a global DNS cache.
 * Global DNS cache is general badness. Do not use. This will be removed in
 * a future version. Use the share interface instead!
 *
 * Returns 0 on success, 1 on failure.
 */
int Curl_global_host_cache_init(void);
void Curl_global_host_cache_dtor(void);
struct curl_hash *Curl_global_host_cache_get(void);

#define Curl_global_host_cache_use(__p) ((__p)->set.global_dns_cache)
#define Curl_global_host_cache_use(__p) \
  ((__p)->dns.hostcachetype == HCACHE_GLOBAL)

struct Curl_dns_entry {
  Curl_addrinfo *addr;
+8 −8
Original line number Diff line number Diff line
@@ -457,11 +457,8 @@ CURLcode Curl_close(struct SessionHandle *data)
    return CURLE_OK;
  }

  if( ! (data->share && data->share->hostcache) ) {
    if( !Curl_global_host_cache_use(data)) {
  if(data->dns.hostcachetype == HCACHE_PRIVATE)
    Curl_hash_destroy(data->dns.hostcache);
    }
  }

  if(data->state.rangestringalloc)
    free(data->state.range);
@@ -782,10 +779,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
  case CURLOPT_DNS_USE_GLOBAL_CACHE:
    {
      long use_cache = va_arg(param, long);
      if(use_cache)
      if(use_cache) {
        Curl_global_host_cache_init();

      data->set.global_dns_cache = (bool)(0 != use_cache);
        data->dns.hostcachetype = HCACHE_GLOBAL;
      }
      else
        /* not global makes it private by default then */
        data->dns.hostcachetype = HCACHE_PRIVATE;
    }
    break;
  case CURLOPT_SSL_CIPHER_LIST:
Loading