- Constantine Sapuntzakis posted bug #2891595

(http://curl.haxx.se/bug/view.cgi?id=2891595) which identified how an entry
  in the DNS cache would linger too long if the request that added it was in
  use that long. He also provided the patch that now makes libcurl capable of
  still doing a request while the DNS hash entry may get timed out.
This commit is contained in:
Daniel Stenberg 2009-11-11 09:31:37 +00:00
parent 107c4d878a
commit fb5f332834
5 changed files with 44 additions and 22 deletions

View file

@ -140,8 +140,8 @@ mk_hash_element(const void *key, size_t key_len, const void *p)
#define FETCH_LIST(x,y,z) x->table[x->hash_func(y, z, x->slots)]
/* Return the data in the hash. If there already was a match in the hash,
that data is returned. */
/* Insert the data in the hash. If there already was a match in the hash,
that data is replaced. */
void *
Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p)
{
@ -152,8 +152,9 @@ Curl_hash_add(struct curl_hash *h, void *key, size_t key_len, void *p)
for (le = l->head; le; le = le->next) {
he = (struct curl_hash_element *) le->ptr;
if(h->comp_func(he->key, he->key_len, key, key_len)) {
h->dtor(p); /* remove the NEW entry */
return he->ptr; /* return the EXISTING entry */
Curl_llist_remove(l, le, (void *)h);
--h->size;
break;
}
}