Skip to content

Commit

Permalink
director: Log user's kill_state with a human-readable string.
Browse files Browse the repository at this point in the history
  • Loading branch information
sirainen committed Oct 25, 2016
1 parent 283aea2 commit 825dc91
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/director/director-connection.c
Expand Up @@ -572,8 +572,10 @@ director_user_refresh(struct director_connection *conn,
}
if (user->to_move != NULL)
str_append(str, ",moving");
if (user->kill_state != USER_KILL_STATE_NONE)
str_printfa(str, ",kill_state=%d", user->kill_state);
if (user->kill_state != USER_KILL_STATE_NONE) {
str_printfa(str, ",kill_state=%s",
user_kill_state_names[user->kill_state]);
}
str_append_c(str, ')');
i_error("%s", str_c(str));

Expand Down
9 changes: 9 additions & 0 deletions src/director/user-directory.c
Expand Up @@ -36,6 +36,15 @@ struct user_directory {
unsigned int user_near_expiring_secs;
};

const char *user_kill_state_names[USER_KILL_STATE_DELAY+1] = {
"none",
"killing",
"notify-received",
"waiting-for-notify",
"waiting-for-everyone",
"delay",
};

static void user_move_iters(struct user_directory *dir, struct user *user)
{
struct user_directory_iter *const *iterp;
Expand Down
2 changes: 2 additions & 0 deletions src/director/user-directory.h
Expand Up @@ -21,7 +21,9 @@ enum user_kill_state {
the user move (although it could be earlier if we added a new
USER-MOVED notification). */
USER_KILL_STATE_DELAY
/* NOTE: remember to update also user_kill_state_names[] */
};
extern const char *user_kill_state_names[USER_KILL_STATE_DELAY+1];

struct user {
/* sorted by time */
Expand Down

0 comments on commit 825dc91

Please sign in to comment.