} else if (dir->left == NULL) {
/* no conflicts yet */
} else if (dir->left->host == conn->host) {
- i_warning("Replacing left director connection %s with %s",
+ e_warning(dir->event,
+ "Replacing left director connection %s with %s",
dir->left->host->name, conn->host->name);
director_connection_deinit(&dir->left, t_strdup_printf(
"Replacing with %s", conn->host->name));
if (director_host_cmp_to_self(conn->host, dir->right->host,
dir->self_host) <= 0) {
/* the old connection is the correct one */
- i_warning("Aborting incorrect outgoing connection to %s "
+ e_warning(dir->event,
+ "Aborting incorrect outgoing connection to %s "
"(already connected to correct one: %s)",
conn->host->name, dir->right->host->name);
conn->wrong_host = TRUE;
return FALSE;
}
- i_warning("Replacing right director connection %s with %s",
+ e_warning(dir->event,
+ "Replacing right director connection %s with %s",
dir->right->host->name, conn->host->name);
director_connection_deinit(&dir->right, t_strdup_printf(
"Replacing with %s", conn->host->name));
diff = ioloop_time - remote_time;
if (diff > DIRECTOR_MAX_CLOCK_DIFF_WARN_SECS ||
(diff < 0 && -diff > DIRECTOR_MAX_CLOCK_DIFF_WARN_SECS)) {
- i_warning("Director %s clock differs from ours by %d secs",
+ e_warning(dir->event,
+ "Director %s clock differs from ours by %d secs",
conn->name, diff);
}
}
vhost_count = I_MIN(vhost_count, host->vhost_count);
str_printfa(str, "setting to state=%s vhosts=%u",
down ? "down" : "up", vhost_count);
- i_warning("%s", str_c(str));
+ e_warning(conn->dir->event, "%s", str_c(str));
/* make the change appear to come from us, so it
reaches the full ring */
dir_host = NULL;
director_connection_append_stats(conn, str);
str_append_c(str, ')');
if (handshake_msecs >= DIRECTOR_HANDSHAKE_WARN_SECS*1000)
- i_warning("%s", str_c(str));
+ e_warning(dir->event, "%s", str_c(str));
else
- i_info("%s", str_c(str));
+ e_info(dir->event, "%s", str_c(str));
/* the host is up now, make sure we can connect to it immediately
if needed */
timestamp);
return FALSE;
} else if (seq < host->last_sync_seq) {
- i_warning("Last SYNC seq for %s appears to be stale, resetting "
+ e_warning(dir->event,
+ "Last SYNC seq for %s appears to be stale, resetting "
"(seq=%u, timestamp=%u -> seq=%u, timestamp=%u)",
host->name, host->last_sync_seq,
host->last_sync_timestamp, seq, timestamp);
str_to_uintmax(args[1], &send_buffer_size) == 0) {
int diff_secs = ioloop_time - sent_time;
if (diff_secs*1000+500 > DIRECTOR_CONNECTION_PINGPONG_WARN_MSECS) {
- i_warning("director(%s): PING response took %d secs to receive "
+ e_warning(conn->dir->event,
+ "director(%s): PING response took %d secs to receive "
"(send buffer was %ju bytes)",
conn->name, diff_secs, send_buffer_size);
}
if (ping_msecs > DIRECTOR_CONNECTION_PINGPONG_WARN_MSECS) {
string_t *extra = t_str_new(128);
director_ping_append_extra(conn, extra, sent_time, send_buffer_size);
- i_warning("director(%s): PONG response took %u.%03u secs (%s)",
+ e_warning(conn->dir->event,
+ "director(%s): PONG response took %u.%03u secs (%s)",
conn->name, ping_msecs/1000, ping_msecs%1000,
str_c(extra));
}
if (strcmp(cmd, "CONNECT") == 0)
return director_cmd_connect(conn, args);
if (strcmp(cmd, "QUIT") == 0) {
- i_warning("Director %s disconnected us with reason: %s",
+ e_warning(conn->dir->event,
+ "Director %s disconnected us with reason: %s",
conn->name, t_strarray_join(args, " "));
return FALSE;
}
i_assert(conn->connected);
if (conn->connect_request_to != NULL) {
- i_warning("Director %s tried to connect to us, "
+ e_warning(conn->dir->event,
+ "Director %s tried to connect to us, "
"should use %s instead",
conn->name, conn->connect_request_to->name);
return;
conn->to_ping = timeout_add(DIRECTOR_CONNECTION_ME_TIMEOUT_MSECS,
director_connection_init_timeout, conn);
- i_info("Incoming connection from director %s", conn->name);
+ e_info(dir->event, "Incoming connection from director %s", conn->name);
director_connection_send_handshake(conn);
return conn;
}
static void ring_noconn_warning(struct director *dir)
{
if (!dir->ring_handshaked) {
- i_warning("Delaying all requests "
+ e_warning(dir->event, "Delaying all requests "
"until all directors have connected");
} else {
- i_warning("Delaying new user requests until ring is synced");
+ e_warning(dir->event,
+ "Delaying new user requests until ring is synced");
}
dir->ring_handshake_warning_sent = TRUE;
timeout_remove(&dir->to_handshake_warning);
str_printfa(str, ", last protocol failure %ds ago",
(int)(ioloop_time - host->last_protocol_failure));
}
- i_info("Connecting to %s:%u (as %s%s): %s",
+ e_info(dir->event, "Connecting to %s:%u (as %s%s): %s",
host->ip_str, host->port,
net_ip2addr(&dir->self_ip), str_c(str), reason);
}
/* we're the only one */
if (count > 1) {
- i_warning("director: Couldn't connect to right side, "
+ e_warning(dir->event,
+ "director: Couldn't connect to right side, "
"we must be the only director left");
}
if (dir->left != NULL) {
/* since we couldn't connect to it,
it must have failed recently */
- i_warning("director: Assuming %s is dead, disconnecting",
+ e_warning(dir->event,
+ "director: Assuming %s is dead, disconnecting",
director_connection_get_name(dir->left));
director_connection_deinit(&dir->left,
"This connection is dead?");
timeout_remove(&dir->to_handshake_warning);
if (dir->ring_handshake_warning_sent) {
- i_warning("Directors have been connected, "
+ e_warning(dir->event,
+ "Directors have been connected, "
"continuing delayed requests");
dir->ring_handshake_warning_sent = FALSE;
}
timeout_remove(&dir->to_handshake_warning);
if (dir->ring_handshake_warning_sent) {
- i_warning("Ring is synced, continuing delayed requests "
+ e_warning(dir->event,
+ "Ring is synced, continuing delayed requests "
"(syncing took %d secs, hosts_hash=%u)",
(int)(ioloop_time - dir->ring_last_sync_time),
mail_hosts_hash(dir->mail_hosts));
hanging due to some bug. */
if (dir->to_reconnect == NULL &&
!director_has_any_outgoing_connections(dir)) {
- i_warning("Right side connection is unexpectedly lost, reconnecting");
+ e_warning(dir->event,
+ "Right side connection is unexpectedly lost, reconnecting");
director_connect(dir, "Right side connection lost");
}
} else if (dir->left != NULL) {
const char *cmd;
if (log) {
- i_info("Adding director %s to ring (requested by %s)",
+ e_info(added_host->dir->event,
+ "Adding director %s to ring (requested by %s)",
added_host->name, src->name);
}
unsigned int i, count;
const char *cmd;
- i_info("Removing director %s from ring (requested by %s)",
+ e_info(dir->event, "Removing director %s from ring (requested by %s)",
removed_host->name, src->name);
if (removed_host->self && !src->self) {
director_flush_host(conn->dir, conn->dir->self_host,
NULL, *hostp);
}
- i_warning("Flushed all backend hosts with %u users. This is an unsafe "
+ e_warning(conn->dir->event,
+ "Flushed all backend hosts with %u users. This is an unsafe "
"operation and may cause the same users to end up in multiple backends.",
total_user_count);
o_stream_nsend(conn->output, "OK\n", 3);
}
if (user == NULL) {
int msecs = timeval_diff_msecs(&ioloop_timeval, &cmd->start_time);
- i_info("Moved %u users in %u hosts in %u.%03u secs (max parallel=%u)",
+ e_info(dir->event,
+ "Moved %u users in %u hosts in %u.%03u secs (max parallel=%u)",
cmd->reset_count, cmd->hosts_count - cmd->host_start_idx,
msecs / 1000, msecs % 1000, cmd->max_moving_users);
director_iterate_users_deinit(&cmd->iter);
#include "bsearch-insert-pos.h"
#include "crc32.h"
#include "md5.h"
+#include "director.h"
#include "user-directory.h"
#include "mail-host.h"
{
if (host->down != down) {
const char *updown = down ? "down" : "up";
- i_info("%sHost %s changed %s "
+ e_info(host->list->dir->event, "%sHost %s changed %s "
"(vhost_count=%u last_updown_change=%ld)",
log_prefix, host->ip_str, updown,
host->vhost_count, (long)host->last_updown_change);
void mail_host_set_vhost_count(struct mail_host *host, unsigned int vhost_count,
const char *log_prefix)
{
- i_info("%sHost %s vhost count changed from %u to %u",
+ e_info(host->list->dir->event,
+ "%sHost %s vhost count changed from %u to %u",
log_prefix, host->ip_str,
host->vhost_count, vhost_count);
host = director_host_lookup_ip(director, ip);
if (host == NULL || host->removed) {
- i_warning("Connection from %s: Server not listed in "
+ e_warning(director->event,
+ "Connection from %s: Server not listed in "
"director_servers, dropping", net_ip2addr(ip));
return -1;
}
diff = ioloop_time - user->timestamp;
if (diff >= (int)dir->set->director_user_expire) {
- i_warning("notify: User %s refreshed too late (%d secs)",
+ e_warning(dir->event,
+ "notify: User %s refreshed too late (%d secs)",
username, diff);
}
user_directory_refresh(tag->users, user);
#include "hash.h"
#include "llist.h"
#include "mail-host.h"
+#include "director.h"
/* n% of timeout_secs */
#define USER_NEAR_EXPIRING_PERCENTAGE 10
return TRUE;
}
- i_warning("User %u weakness appears to be stuck, removing it",
+ e_warning(dir->director->event,
+ "User %u weakness appears to be stuck, removing it",
user->username_hash);
}
return FALSE;