changeset 22044:c73b9f07b067

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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 18 May 2017 11:57:38 +0300
parents 81e013b3207d
children ba0cb10b2845
files src/director/director.c src/director/director.h
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/director.c	Sun Apr 30 12:31:48 2017 +0300
+++ b/src/director/director.c	Thu May 18 11:57:38 2017 +0300
@@ -805,6 +805,8 @@
 		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 @@
 	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,
--- a/src/director/director.h	Sun Apr 30 12:31:48 2017 +0300
+++ b/src/director/director.h	Thu May 18 11:57:38 2017 +0300
@@ -76,6 +76,8 @@
 	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;