diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-02-15 16:57:53 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-02-15 16:57:53 +0000 |
commit | a7e04cac78ac0ff3475aa7983183d33e8abb681f (patch) | |
tree | db525dfb3c7db233b2771fc06ba56e91dd6f8d58 /lib | |
parent | 8ddc18a4f961dc8eb4ae41101cb2bf8f87d4cd7f (diff) |
Mark the dns entry 'inuse' properly even when used from the cache. This
seems to correct some host cache screw-ups I could reproduce.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hostip.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/hostip.c b/lib/hostip.c index 3e2196120..f1583eaed 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -191,7 +191,7 @@ hostcache_prune(curl_hash *hostcache, int cache_timeout, int now) user.cache_timeout = cache_timeout; user.now = now; - + Curl_hash_clean_with_criterium(hostcache, (void *) &user, hostcache_timestamp_remove); @@ -367,8 +367,10 @@ int Curl_resolv(struct connectdata *conn, rc = 0; } } - else + else { + dns->inuse++; /* we use it! */ rc = 0; + } *entry = dns; @@ -382,9 +384,15 @@ void Curl_resolv_unlock(struct SessionHandle *data, struct Curl_dns_entry *dns) dns->inuse--; +#ifdef CURLDEBUG + if(dns->inuse < 0) { + infof(data, "Interal host cache screw-up!"); + *(char **)0=NULL; + } +#endif + if(data->share) Curl_share_unlock(data, CURL_LOCK_DATA_DNS); - } /* |