dovecot-2.0: director: If outgoing connection dies soon, mark th...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Sep 2 17:35:24 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/ff5a47012287
changeset: 12065:ff5a47012287
user: Timo Sirainen <tss at iki.fi>
date: Thu Sep 02 15:35:21 2010 +0100
description:
director: If outgoing connection dies soon, mark the host as failed to avoid immediate reconnect.
diffstat:
src/director/director-connection.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diffs (39 lines):
diff -r d55d6a72a043 -r ff5a47012287 src/director/director-connection.c
--- a/src/director/director-connection.c Thu Sep 02 13:50:17 2010 +0100
+++ b/src/director/director-connection.c Thu Sep 02 15:35:21 2010 +0100
@@ -34,12 +34,16 @@
#define DIRECTOR_CONNECTION_PING_INTERVAL_MSECS (15*1000)
/* How long to wait before sending PING while waiting for SYNC reply */
#define DIRECTOR_CONNECTION_SYNC_TIMEOUT_MSECS 1000
+/* If outgoing director connection exists for less than this many seconds,
+ mark the host as failed so we won't try to reconnect to it immediately */
+#define DIRECTOR_SUCCESS_MIN_CONNECT_SECS 10
struct director_connection {
struct director_connection *prev, *next;
struct director *dir;
char *name;
+ time_t created;
/* for incoming connections the director host isn't known until
ME-line is received */
@@ -887,6 +891,7 @@
struct director_connection *conn;
conn = i_new(struct director_connection, 1);
+ conn->created = ioloop_time;
conn->fd = fd;
conn->dir = dir;
conn->input = i_stream_create_fd(conn->fd, MAX_INBUF_SIZE, FALSE);
@@ -991,6 +996,10 @@
*_conn = NULL;
+ if (conn->host != NULL && !conn->in &&
+ conn->created + DIRECTOR_SUCCESS_MIN_CONNECT_SECS > ioloop_time)
+ conn->host->last_failed = ioloop_time;
+
DLLIST_REMOVE(&dir->connections, conn);
if (dir->left == conn)
dir->left = NULL;
More information about the dovecot-cvs
mailing list