dovecot-2.2: auth: Userdb iteration optimization.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Oct 10 21:45:33 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/a36fe1250606
changeset: 17939:a36fe1250606
user: Timo Sirainen <tss at iki.fi>
date: Sat Oct 11 00:01:09 2014 +0300
description:
auth: Userdb iteration optimization.
Don't keep re-creating the timeout after iterating each user.
diffstat:
src/auth/auth-worker-server.c | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diffs (51 lines):
diff -r d15da5f1731e -r a36fe1250606 src/auth/auth-worker-server.c
--- a/src/auth/auth-worker-server.c Sat Oct 11 00:43:38 2014 +0300
+++ b/src/auth/auth-worker-server.c Sat Oct 11 00:01:09 2014 +0300
@@ -46,6 +46,7 @@
unsigned int received_error:1;
unsigned int restart:1;
unsigned int shutdown:1;
+ unsigned int timeout_pending_resume:1;
};
static ARRAY(struct auth_worker_connection *) connections = ARRAY_INIT;
@@ -278,6 +279,7 @@
timeout_reset(conn->to);
} else {
conn->request = NULL;
+ conn->timeout_pending_resume = FALSE;
timeout_remove(&conn->to);
conn->to = timeout_add(AUTH_WORKER_MAX_IDLE_SECS * 1000,
auth_worker_idle_timeout, conn);
@@ -285,6 +287,7 @@
}
if (!request->callback(line, request->context) && conn->io != NULL) {
+ conn->timeout_pending_resume = FALSE;
timeout_remove(&conn->to);
io_remove(&conn->io);
return FALSE;
@@ -411,6 +414,7 @@
static void worker_input_resume(struct auth_worker_connection *conn)
{
+ conn->timeout_pending_resume = FALSE;
timeout_remove(&conn->to);
conn->to = timeout_add(AUTH_WORKER_LOOKUP_TIMEOUT_SECS * 1000,
auth_worker_call_timeout, conn);
@@ -456,9 +460,12 @@
{
if (conn->io == NULL)
conn->io = io_add(conn->fd, IO_READ, worker_input, conn);
- if (conn->to != NULL)
- timeout_remove(&conn->to);
- conn->to = timeout_add_short(0, worker_input_resume, conn);
+ if (!conn->timeout_pending_resume) {
+ conn->timeout_pending_resume = TRUE;
+ if (conn->to != NULL)
+ timeout_remove(&conn->to);
+ conn->to = timeout_add_short(0, worker_input_resume, conn);
+ }
}
void auth_worker_server_init(void)
More information about the dovecot-cvs
mailing list