From: Timo Sirainen Date: Thu, 20 Oct 2016 13:41:23 +0000 (+0300) Subject: director: Code cleanup - move enum user_kill_state to director.h X-Git-Tag: 2.2.26~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6d1e5a3c5fc8cd9cf5217baf9221ee55c1ad47f6;p=thirdparty%2Fdovecot%2Fcore.git director: Code cleanup - move enum user_kill_state to director.h This will be needed by following commits --- diff --git a/src/director/director.c b/src/director/director.c index 0eddfac467..451a587151 100644 --- a/src/director/director.c +++ b/src/director/director.c @@ -29,6 +29,16 @@ bool director_debug; +const char *user_kill_state_names[USER_KILL_STATE_DELAY+1] = { + "none", + "killing", + "notify-received", + "waiting-for-notify", + "waiting-for-everyone", + "flushing", + "delay", +}; + static struct log_throttle *user_move_throttle; static struct log_throttle *user_kill_fail_throttle; diff --git a/src/director/director.h b/src/director/director.h index 9cd6f8f8af..28bfad4b4e 100644 --- a/src/director/director.h +++ b/src/director/director.h @@ -35,6 +35,32 @@ struct director; struct mail_host; struct user; +enum user_kill_state { + /* User isn't being killed */ + USER_KILL_STATE_NONE, + /* We're still killing the user's connections */ + USER_KILL_STATE_KILLING, + /* Like above, but our left side already announced it was finished + with killing its user connections */ + USER_KILL_STATE_KILLING_NOTIFY_RECEIVED, + /* We're done killing, but we have to wait for the left side to + finish killing its user connections before sending USER-KILLED to + our right side */ + USER_KILL_STATE_KILLED_WAITING_FOR_NOTIFY, + /* We're done killing, but waiting for USER-KILLED-EVERYWHERE + notification until this state gets reset. */ + USER_KILL_STATE_KILLED_WAITING_FOR_EVERYONE, + /* Waiting for the flush socket to finish. */ + USER_KILL_STATE_FLUSHING, + /* Wait for a while for the user connections to actually die. Note that + only at this stage we can be sure that all the directors know about + 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]; + typedef void director_state_change_callback_t(struct director *dir); struct director { diff --git a/src/director/user-directory.c b/src/director/user-directory.c index f516d4c565..67798083d6 100644 --- a/src/director/user-directory.c +++ b/src/director/user-directory.c @@ -36,16 +36,6 @@ 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", - "flushing", - "delay", -}; - static void user_move_iters(struct user_directory *dir, struct user *user) { struct user_directory_iter *const *iterp; diff --git a/src/director/user-directory.h b/src/director/user-directory.h index ef5b4bf88b..21df29d85e 100644 --- a/src/director/user-directory.h +++ b/src/director/user-directory.h @@ -1,31 +1,7 @@ #ifndef USER_DIRECTORY_H #define USER_DIRECTORY_H -enum user_kill_state { - /* User isn't being killed */ - USER_KILL_STATE_NONE, - /* We're still killing the user's connections */ - USER_KILL_STATE_KILLING, - /* Like above, but our left side already announced it was finished - with killing its user connections */ - USER_KILL_STATE_KILLING_NOTIFY_RECEIVED, - /* We're done killing, but we have to wait for the left side to - finish killing its user connections before sending USER-KILLED to - our right side */ - USER_KILL_STATE_KILLED_WAITING_FOR_NOTIFY, - /* We're done killing, but waiting for USER-KILLED-EVERYWHERE - notification until this state gets reset. */ - USER_KILL_STATE_KILLED_WAITING_FOR_EVERYONE, - /* Waiting for the flush socket to finish. */ - USER_KILL_STATE_FLUSHING, - /* Wait for a while for the user connections to actually die. Note that - only at this stage we can be sure that all the directors know about - 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]; +#include "director.h" struct user { /* sorted by time */