dovecot-2.1: director: Don't handle pending requests from all ar...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Oct 22 15:21:04 EEST 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/cd646623a1a8
changeset: 14775:cd646623a1a8
user: Timo Sirainen <tss at iki.fi>
date: Mon Oct 22 15:20:57 2012 +0300
description:
director: Don't handle pending requests from all around the code.
I'm not sure if this actually fixes any bugs, but it definitely makes the
state cleaner.
diffstat:
src/director/director.c | 15 ++++++++++++++-
src/director/director.h | 1 +
2 files changed, 15 insertions(+), 1 deletions(-)
diffs (45 lines):
diff -r e4c337f38ed6 -r cd646623a1a8 src/director/director.c
--- a/src/director/director.c Mon Oct 22 15:17:39 2012 +0300
+++ b/src/director/director.c Mon Oct 22 15:20:57 2012 +0300
@@ -787,9 +787,20 @@
user->username_hash));
}
+static void director_state_callback_timeout(struct director *dir)
+{
+ timeout_remove(&dir->to_callback);
+ dir->state_change_callback(dir);
+}
+
void director_set_state_changed(struct director *dir)
{
- dir->state_change_callback(dir);
+ /* we may get called to here from various places. use a timeout to
+ make sure the state callback is called with a clean state. */
+ if (dir->to_callback == NULL) {
+ dir->to_callback =
+ timeout_add(0, director_state_callback_timeout, dir);
+ }
}
void director_update_send(struct director *dir, struct director_host *src,
@@ -866,6 +877,8 @@
timeout_remove(&dir->to_sync);
if (dir->to_remove_dirs != NULL)
timeout_remove(&dir->to_remove_dirs);
+ if (dir->to_callback != NULL)
+ timeout_remove(&dir->to_callback);
while (array_count(&dir->dir_hosts) > 0) {
hostp = array_idx(&dir->dir_hosts, 0);
host = *hostp;
diff -r e4c337f38ed6 -r cd646623a1a8 src/director/director.h
--- a/src/director/director.h Mon Oct 22 15:17:39 2012 +0300
+++ b/src/director/director.h Mon Oct 22 15:20:57 2012 +0300
@@ -44,6 +44,7 @@
ARRAY_DEFINE(connections, struct director_connection *);
struct timeout *to_reconnect;
struct timeout *to_sync;
+ struct timeout *to_callback;
/* current mail hosts */
struct mail_host_list *mail_hosts;
More information about the dovecot-cvs
mailing list