]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Fix flush to kick the user also when all backends are down
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 19 Sep 2017 22:47:38 +0000 (01:47 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 21 Sep 2017 08:04:38 +0000 (11:04 +0300)
The user's host can't change, because there are no other hosts. So add a
new parameter to force the kick anyway.

src/director/director.c
src/director/director.h
src/director/doveadm-connection.c

index 4d9a539c3436d640ef05a0c8a1e2dbd873741d83..1a4b5a45a72b14cf559969d775dc8f9e494cae6e 100644 (file)
@@ -986,7 +986,7 @@ static void director_user_move_timeout(struct user *user)
 
 void director_kill_user(struct director *dir, struct director_host *src,
                        struct user *user, struct mail_tag *tag,
-                       struct mail_host *old_host)
+                       struct mail_host *old_host, bool forced_kick)
 {
        struct director_kill_context *ctx;
        const char *cmd;
@@ -1017,7 +1017,7 @@ void director_kill_user(struct director *dir, struct director_host *src,
                                   director_user_move_timeout, user);
        ctx->kill_state = USER_KILL_STATE_KILLING;
 
-       if (old_host != NULL && old_host != user->host) {
+       if ((old_host != NULL && old_host != user->host) || forced_kick) {
                cmd = t_strdup_printf("proxy\t*\tKICK-DIRECTOR-HASH\t%u",
                                      user->username_hash);
                ctx->callback_pending = TRUE;
@@ -1097,7 +1097,7 @@ void director_move_user(struct director *dir, struct director_host *src,
                user->username_hash, net_ip2addr(&user->host->ip)));
        /* kill the user only after sending the USER-MOVE, because the kill
           may finish instantly. */
-       director_kill_user(dir, src, user, host->tag, old_host);
+       director_kill_user(dir, src, user, host->tag, old_host, FALSE);
 }
 
 static void
index 370642b3edbc201d1e3476989f633a9da50baf3a..744aaba1800d943e7423da3ca123fdc29ba3c9dd 100644 (file)
@@ -203,7 +203,7 @@ void director_update_user_weak(struct director *dir, struct director_host *src,
                               struct user *user) ATTR_NULL(3);
 void director_kill_user(struct director *dir, struct director_host *src,
                        struct user *user, struct mail_tag *tag,
-                       struct mail_host *old_host);
+                       struct mail_host *old_host, bool forced_kick);
 void director_move_user(struct director *dir, struct director_host *src,
                        struct director_host *orig_src,
                        unsigned int username_hash, struct mail_host *host)
index 355fcb15931415ea99190fc7e64c8d5ca8c8f49f..54c8b1d1e92d5ab0e563822b6071898bbb4e4891 100644 (file)
@@ -469,7 +469,8 @@ director_host_reset_users(struct director_reset_cmd *cmd,
                                /* there are no more available backends.
                                   kick the user instead. */
                                director_kill_user(dir, dir->self_host, user,
-                                                  user->host->tag, user->host);
+                                                  user->host->tag, user->host,
+                                                  TRUE);
                                users_killed = TRUE;
                        }
                } T_END;