aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-10-20 08:45:33 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-10-20 08:45:33 +0000
commit31b6bb6a41ce1a59d26b27be955a9073c393a796 (patch)
treef747976fa92bb61218f23c52a40218483d2c5296 /lib
parentb84607ff7b89c79b769632a91b3620985280561d (diff)
lock the DNS cache properly before adding an entry when using asynch DNS
Diffstat (limited to 'lib')
-rw-r--r--lib/hostip.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/hostip.c b/lib/hostip.c
index 93a732d90..c06961e79 100644
--- a/lib/hostip.c
+++ b/lib/hostip.c
@@ -527,8 +527,16 @@ static void host_callback(void *arg, /* "struct connectdata *" */
/* pack_hostent() copies to and shrinks the target buffer */
struct hostent *he = pack_hostent(&bufp, hostent);
- dns = cache_resolv_response(conn->data, he,
+ struct SessionHandle *data = conn->data;
+
+ if(data->share)
+ Curl_share_lock(data, CURL_LOCK_DATA_DNS, CURL_LOCK_ACCESS_SINGLE);
+
+ dns = cache_resolv_response(data, he,
conn->async.hostname, conn->async.port);
+
+ if(data->share)
+ Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
}
}