Skip to content

Commit

Permalink
director: Add old host's up/down and vhost count parameters to direct…
Browse files Browse the repository at this point in the history
…or_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.
  • Loading branch information
sirainen committed May 18, 2017
1 parent de5d6bb commit cdc7ca1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/director/director.c
Expand Up @@ -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
};

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/director/director.h
Expand Up @@ -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;

Expand Down

0 comments on commit cdc7ca1

Please sign in to comment.