dovecot-2.0: dsync: Don't crash/hang if syncing fails before iol...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 15 20:59:46 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/eb5adb193064
changeset: 12124:eb5adb193064
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 15 18:59:34 2010 +0100
description:
dsync: Don't crash/hang if syncing fails before ioloop is started.

diffstat:

 src/dsync/dsync-brain.c |  7 +++++++
 src/dsync/dsync-brain.h |  1 +
 src/dsync/dsync.c       |  3 ++-
 3 files changed, 10 insertions(+), 1 deletions(-)

diffs (37 lines):

diff -r f026e809113d -r eb5adb193064 src/dsync/dsync-brain.c
--- a/src/dsync/dsync-brain.c	Wed Sep 15 16:28:32 2010 +0100
+++ b/src/dsync/dsync-brain.c	Wed Sep 15 18:59:34 2010 +0100
@@ -900,3 +900,10 @@
 		dsync_worker_has_unexpected_changes(brain->src_worker) ||
 		dsync_worker_has_unexpected_changes(brain->dest_worker);
 }
+
+bool dsync_brain_has_failed(struct dsync_brain *brain)
+{
+	return brain->failed ||
+		dsync_worker_has_failed(brain->src_worker) ||
+		dsync_worker_has_failed(brain->dest_worker);
+}
diff -r f026e809113d -r eb5adb193064 src/dsync/dsync-brain.h
--- a/src/dsync/dsync-brain.h	Wed Sep 15 16:28:32 2010 +0100
+++ b/src/dsync/dsync-brain.h	Wed Sep 15 18:59:34 2010 +0100
@@ -23,5 +23,6 @@
 void dsync_brain_sync_all(struct dsync_brain *brain);
 
 bool dsync_brain_has_unexpected_changes(struct dsync_brain *brain);
+bool dsync_brain_has_failed(struct dsync_brain *brain);
 
 #endif
diff -r f026e809113d -r eb5adb193064 src/dsync/dsync.c
--- a/src/dsync/dsync.c	Wed Sep 15 16:28:32 2010 +0100
+++ b/src/dsync/dsync.c	Wed Sep 15 18:59:34 2010 +0100
@@ -314,7 +314,8 @@
 		server = NULL;
 		dsync_brain_sync(brain);
 
-		master_service_run(master_service, dsync_connected);
+		if (!dsync_brain_has_failed(brain))
+			master_service_run(master_service, dsync_connected);
 	}
 
 	if (brain == NULL)


More information about the dovecot-cvs mailing list