Mercurial > dovecot > core-2.2
changeset 18102:c3736d065d54
auth: Increase timeout for multi-line auth-worker replies to 30 minutes.
This should help with running long-running doveadm -A commands.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 20 Nov 2014 05:40:55 +0900 |
parents | 80ed82a93c1a |
children | df1d0c0e7ae2 |
files | src/auth/auth-worker-server.c |
diffstat | 1 files changed, 17 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/auth/auth-worker-server.c Wed Nov 19 17:37:57 2014 +0900 +++ b/src/auth/auth-worker-server.c Thu Nov 20 05:40:55 2014 +0900 @@ -17,7 +17,13 @@ #include <stdlib.h> #include <unistd.h> +/* Initial lookup timeout */ #define AUTH_WORKER_LOOKUP_TIMEOUT_SECS 60 +/* Timeout for multi-line replies, e.g. listing users. This should be a much + higher value, because e.g. doveadm could be doing some long-running commands + for the users. And because of buffering this timeout is for handling + multiple users, not just one. */ +#define AUTH_WORKER_RESUME_TIMEOUT_SECS (30*60) #define AUTH_WORKER_MAX_IDLE_SECS (60*5) #define AUTH_WORKER_ABORT_SECS 60 #define AUTH_WORKER_DELAY_WARN_SECS 3 @@ -47,6 +53,7 @@ unsigned int restart:1; unsigned int shutdown:1; unsigned int timeout_pending_resume:1; + unsigned int resuming:1; }; static ARRAY(struct auth_worker_connection *) connections = ARRAY_INIT; @@ -276,8 +283,16 @@ { if (strncmp(line, "*\t", 2) == 0) { /* multi-line reply, not finished yet */ - timeout_reset(conn->to); + if (conn->resuming) + timeout_reset(conn->to); + else { + conn->resuming = TRUE; + timeout_remove(&conn->to); + conn->to = timeout_add(AUTH_WORKER_RESUME_TIMEOUT_SECS * 1000, + auth_worker_call_timeout, conn); + } } else { + conn->resuming = FALSE; conn->request = NULL; conn->timeout_pending_resume = FALSE; timeout_remove(&conn->to); @@ -416,7 +431,7 @@ { conn->timeout_pending_resume = FALSE; timeout_remove(&conn->to); - conn->to = timeout_add(AUTH_WORKER_LOOKUP_TIMEOUT_SECS * 1000, + conn->to = timeout_add(AUTH_WORKER_RESUME_TIMEOUT_SECS * 1000, auth_worker_call_timeout, conn); worker_input(conn); }