dovecot-2.2: dsync: Fixed hangs with remote dsyncing

dovecot at dovecot.org dovecot at dovecot.org
Fri Dec 14 11:23:04 EET 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/f9e8cbb2792d
changeset: 15463:f9e8cbb2792d
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Dec 14 11:17:19 2012 +0200
description:
dsync: Fixed hangs with remote dsyncing

diffstat:

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

diffs (28 lines):

diff -r b1267f135417 -r f9e8cbb2792d src/doveadm/dsync/dsync-ibc-stream.c
--- a/src/doveadm/dsync/dsync-ibc-stream.c	Thu Dec 13 12:24:32 2012 +0200
+++ b/src/doveadm/dsync/dsync-ibc-stream.c	Fri Dec 14 11:17:19 2012 +0200
@@ -143,7 +143,11 @@
 
 static int dsync_ibc_stream_read_mail_stream(struct dsync_ibc_stream *ibc)
 {
-	if (i_stream_read(ibc->mail_input) < 0) {
+	while (i_stream_read(ibc->mail_input) > 0) {
+		i_stream_skip(ibc->mail_input,
+			      i_stream_get_data_size(ibc->mail_input));
+	}
+	if (ibc->mail_input->eof) {
 		if (ibc->mail_input->stream_errno != 0) {
 			errno = ibc->mail_input->stream_errno;
 			i_error("dsync(%s): read() failed: %m", ibc->name);
@@ -153,10 +157,10 @@
 		/* finished reading the mail stream */
 		i_assert(ibc->mail_input->eof);
 		i_stream_seek(ibc->mail_input, 0);
+		ibc->has_pending_data = TRUE;
 		ibc->mail_input = NULL;
 		return 1;
 	}
-	i_stream_skip(ibc->mail_input, i_stream_get_data_size(ibc->mail_input));
 	return 0;
 }
 


More information about the dovecot-cvs mailing list