DNS_Mgr: Use Process() for timeout expiration

DNS_Mgr has a GetNextTimeout() implementation that may return 0.0. When
that is the case, its IO source is enqueued as ready with an fd of -1.
This in turn results in Process() being called instead of ProcessFd()
in RunState.cc.

Ensure timeouts behavior is properly handled by actually forwarding
timeout indications to c-ares via DNS_Mgr::Process(). This results
in pending DNS queries for which a timeout happened to actually
timeout (when there's no other connectivity).
This commit is contained in:
Arne Welzel 2023-09-04 17:33:43 +02:00
parent 62c06f7e3a
commit a57c45428f
2 changed files with 10 additions and 1 deletions

View file

@ -1471,6 +1471,15 @@ void DNS_Mgr::ProcessFd(int fd, int flags)
IssueAsyncRequests();
}
void DNS_Mgr::Process()
{
// Process() is called when DNS_Mgr is found "ready" when its
// GetNextTimeout() returns 0.0, but there's no active FD.
//
// Kick off timeouts at least.
ares_process_fd(channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
}
void DNS_Mgr::GetStats(Stats* stats)
{
// TODO: can this use the telemetry framework?

View file

@ -285,7 +285,7 @@ protected:
void IssueAsyncRequests();
// IOSource interface.
void Process() override { }
void Process() override;
void ProcessFd(int fd, int flags) override;
void InitSource() override;
const char* Tag() override { return "DNS_Mgr"; }