]> 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)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 19 Sep 2017 22:47:38 +0000 (01:47 +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 315ccb87d3d09365160ce4bfbad90d027ef469fa..ebd86d0e7dfd4aab17943f9bd5a34b17c1005538 100644 (file)
@@ -1013,7 +1013,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;
@@ -1044,7 +1044,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;
@@ -1124,7 +1124,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 383fa83f5a8988162e6b34c515ccb3dd4a3ad2fa..bfd37e61255a2349cff2487f73294eda2a1999c9 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 d54f6005b26dd694c4baeaa06edc54523d66371a..0ed43882d65993b53b194310b498cb17bd76956f 100644 (file)
@@ -512,7 +512,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;