In that case, the IP of the pending connection may no longer be associated with that host.
If the IP was not found anymore, the i_unreached() error occurred.
* Host
*/
-static inline unsigned int
+static inline bool
http_client_host_get_ip_idx(struct http_client_host *host,
- const struct ip_addr *ip)
+ const struct ip_addr *ip, unsigned int *idx_r)
{
unsigned int i;
for (i = 0; i < host->ips_count; i++) {
- if (net_ip_compare(&host->ips[i], ip))
- return i;
+ if (net_ip_compare(&host->ips[i], ip)) {
+ *idx_r = i;
+ return TRUE;
+ }
}
- i_unreached();
+ return FALSE;
}
struct http_client_host *
if (queue->host->dns_lookup == NULL &&
queue->addr.type != HTTP_CLIENT_PEER_ADDR_UNIX) {
/* we achieved at least one connection the the addr->ip */
- queue->ips_connect_start_idx =
- http_client_host_get_ip_idx(queue->host, &addr->a.tcp.ip);
+ if (!http_client_host_get_ip_idx(queue->host,
+ &addr->a.tcp.ip, &queue->ips_connect_start_idx)) {
+ /* list of IPs changed during connect */
+ queue->ips_connect_start_idx = 0;
+ }
}
/* reset attempt counter */