From cdc7ca129c3433d3e4b9d5e90f4c209e4546dfe9 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 18 May 2017 11:57:38 +0300 Subject: [PATCH] director: Add old host's up/down and vhost count parameters to director_flush_socket 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 | 7 ++++++- src/director/director.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/director/director.c b/src/director/director.c index a2fafad04f..a03f3b98e6 100644 --- a/src/director/director.c +++ b/src/director/director.c @@ -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, diff --git a/src/director/director.h b/src/director/director.h index ffb5c3187e..6ef08adaf0 100644 --- a/src/director/director.h +++ b/src/director/director.h @@ -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;