mirror of
https://github.com/curl/curl.git
synced 2025-09-10 22:22:43 +03:00
asyn-thread: survive a c-ares channel set to NULL
When the c-ares setup fails and we get a NULL channel, the resolve still continues and we just need to survive it and just not get any HTTPS RR. Reported-by: nono303 on github Fixes #16216 Closes #16244
This commit is contained in:
parent
17c287854b
commit
89ed161f56
|
@ -109,6 +109,9 @@ int Curl_ares_perform(ares_channel channel,
|
||||||
int i;
|
int i;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
|
||||||
|
if(!channel)
|
||||||
|
return 0;
|
||||||
|
|
||||||
bitmask = ares_getsock(channel, socks, ARES_GETSOCK_MAXNUM);
|
bitmask = ares_getsock(channel, socks, ARES_GETSOCK_MAXNUM);
|
||||||
|
|
||||||
for(i = 0; i < ARES_GETSOCK_MAXNUM; i++) {
|
for(i = 0; i < ARES_GETSOCK_MAXNUM; i++) {
|
||||||
|
|
|
@ -383,7 +383,8 @@ static void destroy_async_data(struct Curl_easy *data)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_HTTPSRR_ARES
|
#ifdef USE_HTTPSRR_ARES
|
||||||
ares_destroy(data->state.async.tdata->channel);
|
if(data->state.async.tdata->channel)
|
||||||
|
ares_destroy(data->state.async.tdata->channel);
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* if the thread is still blocking in the resolve syscall, detach it and
|
* if the thread is still blocking in the resolve syscall, detach it and
|
||||||
|
@ -490,7 +491,7 @@ static bool init_resolve_thread(struct Curl_easy *data,
|
||||||
}
|
}
|
||||||
#ifdef USE_HTTPSRR_ARES
|
#ifdef USE_HTTPSRR_ARES
|
||||||
if(resolve_httpsrr(data, asp))
|
if(resolve_httpsrr(data, asp))
|
||||||
goto err_exit;
|
infof(data, "Failed HTTPS RR operation");
|
||||||
#endif
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -670,7 +671,7 @@ int Curl_resolver_getsock(struct Curl_easy *data, curl_socket_t *socks)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_HTTPSRR_ARES
|
#ifdef USE_HTTPSRR_ARES
|
||||||
if(data->state.async.tdata) {
|
if(data->state.async.tdata && data->state.async.tdata->channel) {
|
||||||
ret_val = Curl_ares_getsock(data, data->state.async.tdata->channel, socks);
|
ret_val = Curl_ares_getsock(data, data->state.async.tdata->channel, socks);
|
||||||
for(socketi = 0; socketi < (MAX_SOCKSPEREASYHANDLE - 1); socketi++)
|
for(socketi = 0; socketi < (MAX_SOCKSPEREASYHANDLE - 1); socketi++)
|
||||||
if(!ARES_GETSOCK_READABLE(ret_val, socketi) &&
|
if(!ARES_GETSOCK_READABLE(ret_val, socketi) &&
|
||||||
|
|
Loading…
Reference in New Issue
Block a user