Mercurial > dovecot > core-2.2
changeset 22076:6b68ff970c9e
lib-http: client: Fixed race condition between DNS refresh lookup and a soft connection timeout.
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.
author | Stephan Bosch <stephan.bosch@dovecot.fi> |
---|---|
date | Tue, 04 Apr 2017 00:32:07 +0200 |
parents | baa85b2663b5 |
children | a75945a50239 |
files | src/lib-http/http-client-host.c |
diffstat | 1 files changed, 0 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-http/http-client-host.c Wed May 24 17:19:36 2017 +0300 +++ b/src/lib-http/http-client-host.c Tue Apr 04 00:32:07 2017 +0200 @@ -108,8 +108,6 @@ 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"); @@ -147,9 +145,7 @@ 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); }