mirror of
https://github.com/curl/curl.git
synced 2026-05-17 09:56:21 +03:00
set async.done to TRUE last in the addrinfo callback to prevent the risk that
the multi-threaded resolver does wrong
This commit is contained in:
parent
be7ce435c0
commit
2ee6c33412
1 changed files with 5 additions and 1 deletions
|
|
@ -115,7 +115,6 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */
|
|||
struct connectdata *conn = (struct connectdata *)arg;
|
||||
struct Curl_dns_entry *dns = NULL;
|
||||
|
||||
conn->async.done = TRUE;
|
||||
conn->async.status = status;
|
||||
|
||||
if(CURL_ASYNC_SUCCESS == status) {
|
||||
|
|
@ -147,6 +146,11 @@ static void addrinfo_callback(void *arg, /* "struct connectdata *" */
|
|||
|
||||
conn->async.dns = dns;
|
||||
|
||||
/* Set async.done TRUE last in this function since it may be used multi-
|
||||
threaded and once this is TRUE the other thread may read fields from the
|
||||
async struct */
|
||||
conn->async.done = TRUE;
|
||||
|
||||
/* ipv4: The input hostent struct will be freed by ares when we return from
|
||||
this function */
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue