dovecot-2.2: dsync: Fixed hang when sending mail stream to remot...

dovecot at dovecot.org dovecot at dovecot.org
Sat Dec 15 14:25:31 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/6f940b2bfbe6
changeset: 15482:6f940b2bfbe6
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Dec 15 14:24:41 2012 +0200
description:
dsync: Fixed hang when sending mail stream to remote dsync.

diffstat:

 src/doveadm/dsync/dsync-ibc-stream.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (42 lines):

diff -r 1204e8bae160 -r 6f940b2bfbe6 src/doveadm/dsync/dsync-ibc-stream.c
--- a/src/doveadm/dsync/dsync-ibc-stream.c	Sat Dec 15 13:56:16 2012 +0200
+++ b/src/doveadm/dsync/dsync-ibc-stream.c	Sat Dec 15 14:24:41 2012 +0200
@@ -243,6 +243,7 @@
 	struct ostream *output = ibc->output;
 	int ret;
 
+	o_stream_cork(ibc->output);
 	if ((ret = o_stream_flush(output)) < 0)
 		ret = 1;
 	else if (ibc->mail_output != NULL) {
@@ -253,6 +254,7 @@
 
 	if (!dsync_ibc_is_send_queue_full(&ibc->ibc))
 		ibc->ibc.io_callback(ibc->ibc.io_context);
+	o_stream_uncork(ibc->output);
 	return ret;
 }
 
@@ -1368,7 +1370,11 @@
 		ibc->mail_output_last = '\0';
 		ibc->mail_output = mail->input;
 		i_stream_ref(ibc->mail_output);
-		(void)dsync_ibc_stream_send_mail_stream(ibc);
+		if (dsync_ibc_stream_send_mail_stream(ibc) == 0) {
+			/* flush callback isn't being called while output
+			   stream is corked */
+			o_stream_uncork(ibc->output);
+		}
 	}
 }
 
@@ -1471,7 +1477,8 @@
 	struct dsync_ibc_stream *ibc = (struct dsync_ibc_stream *)_ibc;
 
 	o_stream_uncork(ibc->output);
-	o_stream_cork(ibc->output);
+	if (ibc->mail_output == NULL)
+		o_stream_cork(ibc->output);
 }
 
 static bool dsync_ibc_stream_is_send_queue_full(struct dsync_ibc *_ibc)


More information about the dovecot-cvs mailing list