if (dir->left->host != dir->right->host)
director_connection_send(dir->right, connect_str);
else {
- /* there are only two directors */
+ /* there are only two directors, and we already have
+ a connection to this server. */
}
} else {
- /* looks like we're the right side. */
+ /* there are only two directors. connect to the other one. */
(void)director_connect_host(dir, host);
}
return TRUE;
i_assert(dir->right == NULL);
- if (host->last_failed + DIRECTOR_RECONNECT_RETRY_SECS > ioloop_time) {
- /* failed recently, don't try retrying here */
- return -1;
- }
-
fd = net_connect_ip(&host->ip, host->port, &dir->self_ip);
if (fd == -1) {
host->last_failed = ioloop_time;
for (i = 1; i < count; i++) {
unsigned int idx = (self_idx + i) % count;
+ if (hosts[idx]->last_failed +
+ DIRECTOR_RECONNECT_RETRY_SECS > ioloop_time) {
+ /* failed recently, don't try retrying here */
+ continue;
+ }
+
if (director_connect_host(dir, hosts[idx]) == 0)
break;
}