]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Don't allow doveadm to update backend's state if the state is already being...
authorTimo Sirainen <tss@iki.fi>
Sat, 10 Oct 2015 15:32:56 +0000 (18:32 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 10 Oct 2015 15:32:56 +0000 (18:32 +0300)
src/director/doveadm-connection.c

index ac93a6f1897cdf683f56ca66b9121f4528018e5b..5bdf2ff1d00109649f3d694b1f503855cc883cee 100644 (file)
@@ -282,6 +282,10 @@ doveadm_cmd_host_set_or_update(struct doveadm_connection *conn, const char *line
                        return TRUE;
                }
                host = mail_host_add_ip(dir->mail_hosts, &ip, tag);
+       } else if (host->desynced) {
+               o_stream_nsend_str(conn->output,
+                       "host is already being updated - try again later\n");
+               return TRUE;
        }
        if (vhost_count != UINT_MAX)
                mail_host_set_vhost_count(dir->mail_hosts, host, vhost_count);
@@ -323,7 +327,13 @@ doveadm_cmd_host_updown(struct doveadm_connection *conn, bool down,
                o_stream_nsend_str(conn->output, "NOTFOUND\n");
                return TRUE;
        }
-       if (host->down != down) {
+       if (host->down == down)
+               ;
+       else if (host->desynced) {
+               o_stream_nsend_str(conn->output,
+                       "host is already being updated - try again later\n");
+               return TRUE;
+       } else {
                mail_host_set_down(conn->dir->mail_hosts, host,
                                   down, ioloop_time);
                director_update_host(conn->dir, conn->dir->self_host,