]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Add director_ping_idle/max_timeout setting.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 24 Nov 2017 16:22:04 +0000 (18:22 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 26 Nov 2017 10:59:24 +0000 (12:59 +0200)
director_ping_idle_timeout is used when there's otherwise no input coming
from the connection. Changed its default from 10 secs to 30 secs.

director_ping_max_timeout is used when the other director keeps sending
input, but among it is no PONG reply.

src/director/director-connection.c
src/director/director-settings.c
src/director/director-settings.h

index eefada2d383a69ae2d69592e95ff9e58d2161ad3..2218426e306799cc077bf7663ff566a69bdc9c6b 100644 (file)
    or we'll disconnect. Use a slightly larger value than for _SEND_USERS_ so
    that we'll get a better error if the sender decides to disconnect. */
 #define DIRECTOR_CONNECTION_DONE_TIMEOUT_MSECS (40*1000)
-/* How long to wait for PONG for an idling connection */
-#define DIRECTOR_CONNECTION_PING_IDLE_TIMEOUT_MSECS (10*1000)
-/* Maximum time to wait for PONG reply */
-#define DIRECTOR_CONNECTION_PONG_TIMEOUT_MSECS (60*1000)
 /* How long to wait to send PING when connection is idle */
 #define DIRECTOR_CONNECTION_PING_INTERVAL_MSECS (15*1000)
 /* How long to wait before sending PING while waiting for SYNC reply */
    to see if there's other work to be done as well. */
 #define DIRECTOR_HANDSHAKE_MAX_USERS_SENT_PER_FLUSH 10000
 
-#if DIRECTOR_CONNECTION_PONG_TIMEOUT_MSECS <= DIRECTOR_CONNECTION_PING_IDLE_TIMEOUT_MSECS
-#  error DIRECTOR_CONNECTION_PONG_TIMEOUT_MSECS is too low
-#endif
-
 #define CMD_IS_USER_HANDSHAKE(minor_version, args) \
        ((minor_version) < DIRECTOR_VERSION_HANDSHAKE_U_CMD && \
         str_array_length(args) > 2)
@@ -2501,9 +2493,9 @@ void director_connection_ping(struct director_connection *conn)
                return;
 
        timeout_remove(&conn->to_ping);
-       conn->to_ping = timeout_add(DIRECTOR_CONNECTION_PING_IDLE_TIMEOUT_MSECS,
+       conn->to_ping = timeout_add(conn->dir->set->director_ping_idle_timeout*1000,
                                    director_connection_ping_idle_timeout, conn);
-       conn->to_pong = timeout_add(DIRECTOR_CONNECTION_PONG_TIMEOUT_MSECS,
+       conn->to_pong = timeout_add(conn->dir->set->director_ping_max_timeout*1000,
                                    director_connection_pong_timeout, conn);
        director_connection_send(conn, "PING\n");
        conn->ping_waiting = TRUE;
index 3660d25df0492b57dd3bc92d1a091f6d2e09452b..d97ea5cd33a56ddfe9caaf91ae152fc95ccc9f41 100644 (file)
@@ -72,6 +72,8 @@ static const struct setting_define director_setting_defines[] = {
        DEF(SET_STR, director_mail_servers),
        DEF(SET_STR, director_username_hash),
        DEF(SET_STR, director_flush_socket),
+       DEF(SET_TIME, director_ping_idle_timeout),
+       DEF(SET_TIME, director_ping_max_timeout),
        DEF(SET_TIME, director_user_expire),
        DEF(SET_TIME, director_user_kick_delay),
        DEF(SET_UINT, director_max_parallel_moves),
@@ -88,6 +90,8 @@ const struct director_settings director_default_settings = {
        .director_mail_servers = "",
        .director_username_hash = "%Lu",
        .director_flush_socket = "",
+       .director_ping_idle_timeout = 30,
+       .director_ping_max_timeout = 60,
        .director_user_expire = 60*15,
        .director_user_kick_delay = 2,
        .director_max_parallel_moves = 100,
index f18078901e7e5aec533855239a1cb1f1d403fa70..363d48c1426f3ad6018d7ccf20495f9f204fbf59 100644 (file)
@@ -11,6 +11,8 @@ struct director_settings {
        const char *director_username_hash;
        const char *director_flush_socket;
 
+       unsigned int director_ping_idle_timeout;
+       unsigned int director_ping_max_timeout;
        unsigned int director_user_expire;
        unsigned int director_user_kick_delay;
        unsigned int director_max_parallel_moves;