]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lock the DNS cache properly before adding an entry when using asynch DNS
authorDaniel Stenberg <daniel@haxx.se>
Mon, 20 Oct 2003 08:45:33 +0000 (08:45 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 20 Oct 2003 08:45:33 +0000 (08:45 +0000)
lib/hostip.c

index 93a732d90f71f46c0785877f212ec52d286b2dd0..c06961e7907334c33eeaede9d301bbf9622d2308 100644 (file)
@@ -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);
     }
   }