The refreshing DNS lookup cleared all the IPs, but the soft connection timeout (and maybe other code) still relied on them.
Adding tests everywhere for host->ips_count == 0 is annoying, so I changed the DNS lookup code such that the stale IPs remain present while the DNS lookup is being performed.
The pending lookup prevents new connections through http_client_host_refresh(), so this will not create potentially useless connections.
i_assert(!host->explicit_ip);
i_assert(host->dns_lookup == NULL);
- host->ips_count = 0;
-
if (client->set.dns_client != NULL) {
http_client_host_debug(host,
"Performing asynchronous DNS lookup");
host->ips_count = ips_count;
host->ips = i_new(struct ip_addr, ips_count);
memcpy(host->ips, ips, ips_count * sizeof(*ips));
- }
- if (host->ips_count > 0) {
host->ips_timeout = ioloop_timeval;
timeval_add_msecs(&host->ips_timeout, client->set.dns_ttl_msecs);
}