"replacing host %s with %s", username_hash,
net_ip2addr(&user->host->ip), net_ip2addr(&host->ip));
ret = TRUE;
- } else if (user->kill_state != USER_KILL_STATE_NONE) {
+ } else if (USER_IS_BEING_KILLED(user)) {
/* user is still being moved - ignore conflicting host updates
from other directors who don't yet know about the move. */
dir_debug("user refresh: %u is being moved, "
}
if (user->to_move != NULL)
str_append(str, ",moving");
- if (user->kill_state != USER_KILL_STATE_NONE) {
+ if (USER_IS_BEING_KILLED(user)) {
str_printfa(str, ",kill_state=%s",
user_kill_state_names[user->kill_state]);
}
struct director *dir = request->dir;
struct mail_host *host;
- if (user->kill_state != USER_KILL_STATE_NONE) {
+ if (USER_IS_BEING_KILLED(user)) {
/* delay processing this user's connections until
its existing connections have been killed */
request->delay_reason = REQUEST_DELAY_KILL;
user->host->user_count++;
user->timestamp = ioloop_time;
}
- if (user->kill_state == USER_KILL_STATE_NONE) {
+ if (!USER_IS_BEING_KILLED(user)) {
ctx = i_new(struct director_kill_context, 1);
ctx->dir = dir;
ctx->username_hash = username_hash;
if (str_to_uint(args[0], &username_hash) < 0)
username_hash = user_directory_get_username_hash(conn->dir->users, args[0]);
user = user_directory_lookup(conn->dir->users, username_hash);
- if (user != NULL && user->kill_state != USER_KILL_STATE_NONE) {
+ if (user != NULL && USER_IS_BEING_KILLED(user)) {
o_stream_nsend_str(conn->output, "TRYAGAIN\n");
return 1;
}
if (expire_timestamp > ioloop_time)
return TRUE;
- if (user->kill_state != USER_KILL_STATE_NONE) {
+ if (USER_IS_BEING_KILLED(user)) {
/* don't free this user until the kill is finished */
return TRUE;
}
#include "director.h"
+#define USER_IS_BEING_KILLED(user) \
+ ((user)->kill_state != USER_KILL_STATE_NONE)
+
struct user {
/* sorted by time */
struct user *prev, *next;