Mercurial > dovecot > core-2.2
changeset 11349:350208d17fcd HEAD
director: Fixes to connecting to remote director.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 20 May 2010 10:43:19 +0200 |
parents | e688d58b0112 |
children | 5f77c91f3df0 |
files | src/director/director-connection.c src/director/director.c |
diffstat | 2 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/director/director-connection.c Thu May 20 10:02:11 2010 +0200 +++ b/src/director/director-connection.c Thu May 20 10:43:19 2010 +0200 @@ -139,10 +139,11 @@ 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;
--- a/src/director/director.c Thu May 20 10:02:11 2010 +0200 +++ b/src/director/director.c Thu May 20 10:43:19 2010 +0200 @@ -80,11 +80,6 @@ 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; @@ -110,6 +105,12 @@ 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; }