dovecot-2.0: director: Improved debug/error logging.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Apr 8 19:36:54 EEST 2011
details: http://hg.dovecot.org/dovecot-2.0/rev/e9139f74c451
changeset: 12728:e9139f74c451
user: Timo Sirainen <tss at iki.fi>
date: Fri Apr 08 19:36:51 2011 +0300
description:
director: Improved debug/error logging.
diffstat:
src/director/director-connection.c | 29 +++++++++++++++++++++++++----
src/director/director.c | 4 ++++
2 files changed, 29 insertions(+), 4 deletions(-)
diffs (101 lines):
diff -r 2b7af3a16521 -r e9139f74c451 src/director/director-connection.c
--- a/src/director/director-connection.c Fri Apr 08 19:35:27 2011 +0300
+++ b/src/director/director-connection.c Fri Apr 08 19:36:51 2011 +0300
@@ -129,20 +129,23 @@
/* make sure this is the correct incoming connection */
if (host->self) {
/* probably we're trying to find our own ip. it's no */
- i_error("director(%s): Connection from self, dropping",
- host->name);
+ i_error("Connection from self, dropping");
return FALSE;
} else if (dir->left == NULL) {
/* no conflicts yet */
} else if (dir->left->host == host) {
- i_warning("director(%s): Dropping existing connection "
- "in favor of its new connection", host->name);
+ i_warning("Dropping existing connection %s "
+ "in favor of its new connection %s",
+ dir->left->host->name, host->name);
director_connection_deinit(&dir->left);
} else {
if (director_host_cmp_to_self(dir->left->host, host,
dir->self_host) < 0) {
/* the old connection is the correct one.
refer the client there. */
+ i_warning("Director connection %s tried to connect to "
+ "us, should use %s instead",
+ host->name, dir->left->host->name);
director_connection_send(conn, t_strdup_printf(
"CONNECT\t%s\t%u\n",
net_ip2addr(&dir->left->host->ip),
@@ -557,6 +560,8 @@
/* reset failure timestamp so we'll actually try to
connect there. */
host->last_failed = 0;
+ if (conn->dir->debug)
+ i_debug("Received CONNECT reference to %s", host->name);
(void)director_connect_host(conn->dir, host);
return FALSE;
}
@@ -742,6 +747,10 @@
if (!director_connection_handle_handshake(conn, cmd, args)) {
/* invalid commands during handshake,
we probably don't want to reconnect here */
+ if (conn->dir->debug) {
+ i_debug("director(%s): Handshaking failed",
+ conn->host->name);
+ }
if (conn->host != NULL)
conn->host->last_failed = ioloop_time;
return FALSE;
@@ -802,6 +811,10 @@
} T_END;
if (!ret) {
+ if (dir->debug) {
+ i_debug("director(%s): Invalid input, disconnecting",
+ conn->name);
+ }
director_connection_disconnected(&conn);
break;
}
@@ -959,9 +972,14 @@
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 "
+ "(already connected to correct one: %s)",
+ conn->host->name, dir->right->host->name);
director_connection_deinit(&conn);
return;
}
+ i_warning("Replacing director connection %s with %s",
+ dir->right->host->name, conn->host->name);
director_connection_deinit(&dir->right);
}
dir->right = conn;
@@ -1005,6 +1023,9 @@
*_conn = NULL;
+ if (dir->debug && conn->host != NULL)
+ i_debug("Disconnecting from %s", conn->host->name);
+
if (conn->host != NULL && !conn->in &&
conn->created + DIRECTOR_SUCCESS_MIN_CONNECT_SECS > ioloop_time)
conn->host->last_failed = ioloop_time;
diff -r 2b7af3a16521 -r e9139f74c451 src/director/director.c
--- a/src/director/director.c Fri Apr 08 19:35:27 2011 +0300
+++ b/src/director/director.c Fri Apr 08 19:36:51 2011 +0300
@@ -141,6 +141,10 @@
}
if (i == count) {
/* we're the only one */
+ if (dir->debug) {
+ i_debug("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 */
More information about the dovecot-cvs
mailing list