mirror of
https://github.com/curl/curl.git
synced 2025-09-15 16:42:41 +03:00
lock the DNS cache properly before adding an entry when using asynch DNS
This commit is contained in:
parent
b84607ff7b
commit
31b6bb6a41
10
lib/hostip.c
10
lib/hostip.c
|
@ -527,8 +527,16 @@ static void host_callback(void *arg, /* "struct connectdata *" */
|
||||||
/* pack_hostent() copies to and shrinks the target buffer */
|
/* pack_hostent() copies to and shrinks the target buffer */
|
||||||
struct hostent *he = pack_hostent(&bufp, hostent);
|
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);
|
conn->async.hostname, conn->async.port);
|
||||||
|
|
||||||
|
if(data->share)
|
||||||
|
Curl_share_unlock(data, CURL_LOCK_DATA_DNS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user