]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Add old host's up/down and vhost count parameters to director_flush_socket
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 18 May 2017 08:57:38 +0000 (11:57 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 18 May 2017 08:57:38 +0000 (11:57 +0300)
The "down" status allows the script to determine whether it should try to
perform any work on the old host. The vhost count may be unnecessary, but
might be useful for some purpose.

src/director/director.c
src/director/director.h

index a2fafad04f59e72be1225bd7e348e0d75c44743f..a03f3b98e6faf750593062fe0b1b0e192b6324ac 100644 (file)
@@ -808,6 +808,8 @@ director_flush_user(struct director *dir, struct user *user)
                t_strdup_printf("%u", user->username_hash),
                net_ip2addr(&ctx->old_host_ip),
                net_ip2addr(&user->host->ip),
+               ctx->old_host_down ? "down" : "up",
+               dec2str(ctx->old_host_vhost_count),
                NULL
        };
 
@@ -1008,8 +1010,11 @@ director_kill_user(struct director *dir, struct director_host *src,
        ctx->tag = tag;
        ctx->username_hash = user->username_hash;
        ctx->kill_is_self_initiated = src->self;
-       if (old_host != NULL)
+       if (old_host != NULL) {
                ctx->old_host_ip = old_host->ip;
+               ctx->old_host_down = old_host->down;
+               ctx->old_host_vhost_count = old_host->vhost_count;
+       }
 
        dir->users_moving_count++;
        ctx->to_move = timeout_add(DIRECTOR_USER_MOVE_TIMEOUT_MSECS,
index ffb5c3187e29dea663b9347bfbc8d0edb307f460..6ef08adaf01293b6f353a02907d4c51c8ec02c5a 100644 (file)
@@ -76,6 +76,8 @@ struct director_kill_context {
        struct mail_tag *tag;
        unsigned int username_hash;
        struct ip_addr old_host_ip;
+       unsigned int old_host_vhost_count;
+       bool old_host_down;
        bool kill_is_self_initiated;
        bool callback_pending;