From 95def48071e54c769ee063ddf53f05c9595602d2 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 4 Oct 2004 10:36:51 +0000 Subject: Made the dns entry remain locked while a connection to the host remains to allow verbose output during this period. Bertrand Demiddelaer reported and helped fixing. --- lib/hostip.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'lib/hostip.c') diff --git a/lib/hostip.c b/lib/hostip.c index f3aa36c6a..c9c78784f 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -263,8 +263,9 @@ void Curl_hostcache_prune(struct SessionHandle *data) { time_t now; - if(data->set.dns_cache_timeout == -1) - /* cache forever means never prune! */ + if((data->set.dns_cache_timeout == -1) || !data->hostcache) + /* cache forever means never prune, and NULL hostcache means + we can't do it */ return; if(data->share) @@ -459,7 +460,11 @@ int Curl_resolv(struct connectdata *conn, } } else { + if(data->share) + Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE); dns->inuse++; /* we use it! */ + if(data->share) + Curl_share_unlock(data, CURL_LOCK_DATA_DNS); rc = CURLRESOLV_RESOLVED; } -- cgit v1.2.3