We are destroying the ares channel already when we shutdown
resolving. Querying the pollset afterwards is still happening,
especially in event based processing and needs to work in the
absence of a channel.
Fixes #18317
Reported-by: Natris on github
Closes #18318
CURLcode Curl_async_pollset(struct Curl_easy *data, struct easy_pollset *ps)
{
struct async_ares_ctx *ares = &data->state.async.ares;
- DEBUGASSERT(ares->channel);
- return Curl_ares_pollset(data, ares->channel, ps);
+ if(ares->channel)
+ return Curl_ares_pollset(data, ares->channel, ps);
+ return CURLE_OK;
}
/*
timediff_t milli;
CURLcode result = CURLE_OK;
+ DEBUGASSERT(channel);
+ if(!channel)
+ return CURLE_FAILED_INIT;
+
bitmap = ares_getsock(channel, (ares_socket_t *)sockets,
CURL_ARRAYSIZE(sockets));
for(i = 0; i < CURL_ARRAYSIZE(sockets); ++i) {
}
timeout = ares_timeout(channel, &maxtime, &timebuf);
+ if(!timeout)
+ timeout = &maxtime;
milli = curlx_tvtoms(timeout);
Curl_expire(data, milli, EXPIRE_ASYNC_NAME);
return result;