]> granicus.if.org Git - curl/commitdiff
hostip: don't remove DNS entries that are in use
authorRomulo A. Ceccon <romuloceccon@gmail.com>
Tue, 28 Jan 2014 13:59:14 +0000 (11:59 -0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 28 Jan 2014 21:25:48 +0000 (22:25 +0100)
hostcache_timestamp_remove() should remove old *unused* entries from the
host cache, but it never checked whether the entry was actually in
use. This complements commit 030a2b8cb.

Bug: http://curl.haxx.se/bug/view.cgi?id=1327

lib/hostip.c

index 5837e64c7d2fbf93e20a850401e44e29aec24a8f..61d238acdf39cd49239d66263c9c553c7411223f 100644 (file)
@@ -237,7 +237,7 @@ hostcache_timestamp_remove(void *datap, void *hc)
     (struct hostcache_prune_data *) datap;
   struct Curl_dns_entry *c = (struct Curl_dns_entry *) hc;
 
-  return (data->now - c->timestamp >= data->cache_timeout);
+  return !c->inuse && (data->now - c->timestamp >= data->cache_timeout);
 }
 
 /*