]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 18 May 2017 10:26:22 +0000 (13:26 +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 b24b5eb37f907952619228a1aeaa7a4c585cb660..9b55a18aea3b5a39e69ed34f9b85b6366995d7d7 100644 (file)
@@ -805,6 +805,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
        };
 
@@ -1005,8 +1007,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 9df350567f14f7e361acaec10f50e126cc94f189..723c09f565d74f7ed16a629e1948dd39ccdb4def 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;