]> 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 11:13:05 +0000 (13:13 +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 b70223831e61d007cace68cae94753190a3b0fb6..9329d194e7ea6fec05b3d732252a565758e96d99 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_DONE_TIMEOUT_MSECS <= DIRECTOR_CONNECTION_PING_TIMEOUT_MSECS
-#  error DIRECTOR_CONNECTION_DONE_TIMEOUT_MSECS is too low
-#endif
-
-#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)
@@ -2509,9 +2497,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 db1f8a645814cf19af64248ed85c04572e44ce01..1c54c00a5a39d96b309255a22c60fa15904eacd5 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_IN_PORT, director_doveadm_port),
@@ -90,6 +92,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_doveadm_port = 0,
index 703cd1860d50c5d78911627045e77f0b32500637..5b7c9a8e9a691d2bbf65302f3dd722c07430b4cd 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;
        in_port_t director_doveadm_port;