aboutsummaryrefslogtreecommitdiff
path: root/lib/hostip.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/hostip.c')
-rw-r--r--lib/hostip.c9
1 files changed, 7 insertions, 2 deletions
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;
}