]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Fixes to connecting to remote director.
authorTimo Sirainen <tss@iki.fi>
Thu, 20 May 2010 08:43:19 +0000 (10:43 +0200)
committerTimo Sirainen <tss@iki.fi>
Thu, 20 May 2010 08:43:19 +0000 (10:43 +0200)
--HG--
branch : HEAD

src/director/director-connection.c
src/director/director.c

index 4ed8c8d2654a909dc2a8f9c6677dce3072ef5878..61f912c6cbe00d2ee0d69618857f70627be5818d 100644 (file)
@@ -139,10 +139,11 @@ static bool director_cmd_me(struct director_connection *conn,
                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;
index 01164075e8a95cd8bd700a62a1e61cdc8e7dc74a..ca0a6f22de59d8a5aa18058313e79d228c4a56ad 100644 (file)
@@ -80,11 +80,6 @@ int director_connect_host(struct director *dir, struct director_host *host)
 
        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 @@ void director_connect(struct director *dir)
        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;
        }