dovecot-2.0: dsync: Don't give errors when doing a remote sync a...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jul 12 18:27:56 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/5e285530914c
changeset: 11804:5e285530914c
user: Timo Sirainen <tss at iki.fi>
date: Mon Jul 12 16:27:51 2010 +0100
description:
dsync: Don't give errors when doing a remote sync and there are no changes.
diffstat:
src/dsync/dsync-brain.c | 28 +++++++++++++++++++++++-----
src/dsync/dsync-worker.c | 1 +
2 files changed, 24 insertions(+), 5 deletions(-)
diffs (79 lines):
diff -r fa883e27a6de -r 5e285530914c src/dsync/dsync-brain.c
--- a/src/dsync/dsync-brain.c Mon Jul 12 15:32:14 2010 +0100
+++ b/src/dsync/dsync-brain.c Mon Jul 12 16:27:51 2010 +0100
@@ -710,18 +710,26 @@
}
}
-static void dsync_brain_sync_msgs(struct dsync_brain *brain)
+static bool dsync_brain_sync_msgs(struct dsync_brain *brain)
{
ARRAY_TYPE(dsync_brain_mailbox) mailboxes;
pool_t pool;
+ bool ret;
pool = pool_alloconly_create("dsync changed mailboxes", 10240);
p_array_init(&mailboxes, pool, 128);
dsync_brain_get_changed_mailboxes(brain, &mailboxes,
(brain->flags & DSYNC_BRAIN_FLAG_FULL_SYNC) != 0);
- brain->mailbox_sync = dsync_brain_msg_sync_init(brain, &mailboxes);
- dsync_brain_msg_sync_more(brain->mailbox_sync);
+ if (array_count(&mailboxes) > 0) {
+ brain->mailbox_sync =
+ dsync_brain_msg_sync_init(brain, &mailboxes);
+ dsync_brain_msg_sync_more(brain->mailbox_sync);
+ ret = TRUE;
+ } else {
+ ret = FALSE;
+ }
pool_unref(&pool);
+ return ret;
}
static void
@@ -748,6 +756,11 @@
dsync_worker_has_failed(brain->src_worker) ||
dsync_worker_has_failed(brain->dest_worker);
+ if (brain->mailbox_sync == NULL) {
+ /* no mailboxes changed */
+ return;
+ }
+
array_foreach(&brain->mailbox_sync->mailboxes, mailbox) {
/* don't update mailboxes if any changes had failed.
for example if some messages couldn't be saved, we don't
@@ -813,6 +826,9 @@
dsync_worker_subs_input(brain->dest_subs_list);
break;
case DSYNC_STATE_SYNC_MAILBOXES:
+ dsync_worker_set_input_callback(brain->src_worker, NULL, NULL);
+ dsync_worker_set_input_callback(brain->dest_worker, NULL, NULL);
+
dsync_brain_sync_mailboxes(brain);
dsync_brain_sync_dirs(brain);
brain->state++;
@@ -822,8 +838,10 @@
brain->state++;
/* fall through */
case DSYNC_STATE_SYNC_MSGS:
- dsync_brain_sync_msgs(brain);
- break;
+ if (dsync_brain_sync_msgs(brain))
+ break;
+ brain->state++;
+ /* no mailboxes changed */
case DSYNC_STATE_SYNC_MSGS_FLUSH:
/* wait until all saves are done, so we don't try to close
the mailbox too early */
diff -r fa883e27a6de -r 5e285530914c src/dsync/dsync-worker.c
--- a/src/dsync/dsync-worker.c Mon Jul 12 15:32:14 2010 +0100
+++ b/src/dsync/dsync-worker.c Mon Jul 12 16:27:51 2010 +0100
@@ -108,6 +108,7 @@
const mailbox_guid_t mailboxes[],
unsigned int mailbox_count)
{
+ i_assert(mailbox_count > 0);
return worker->v.msg_iter_init(worker, mailboxes, mailbox_count);
}
More information about the dovecot-cvs
mailing list