Mercurial > dovecot > core-2.2
changeset 12935:e9139f74c451
director: Improved debug/error logging.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 08 Apr 2011 19:36:51 +0300 |
parents | 2b7af3a16521 |
children | d14b0fd0a423 |
files | src/director/director-connection.c src/director/director.c |
diffstat | 2 files changed, 29 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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 */