dovecot-2.0: dsync: Fixed a potential hang with remote syncing.

dovecot at dovecot.org dovecot at dovecot.org
Sat Jul 10 20:35:14 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/67445c0f55c0
changeset: 11782:67445c0f55c0
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Jul 10 18:34:33 2010 +0100
description:
dsync: Fixed a potential hang with remote syncing.

diffstat:

 src/dsync/dsync-proxy-client.c |  18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)

diffs (49 lines):

diff -r 94c5bfb31951 -r 67445c0f55c0 src/dsync/dsync-proxy-client.c
--- a/src/dsync/dsync-proxy-client.c	Sat Jul 10 18:21:52 2010 +0100
+++ b/src/dsync/dsync-proxy-client.c	Sat Jul 10 18:34:33 2010 +0100
@@ -52,7 +52,7 @@
 	struct io *io;
 	struct istream *input;
 	struct ostream *output;
-	struct timeout *to;
+	struct timeout *to, *to_input;
 
 	mailbox_guid_t selected_box_guid;
 
@@ -121,6 +121,13 @@
 }
 
 static void
+proxy_client_worker_timeout_input(struct proxy_client_dsync_worker *worker)
+{
+	timeout_remove(&worker->to_input);
+	proxy_client_worker_input(worker);
+}
+
+static void
 proxy_client_worker_msg_get_done(struct proxy_client_dsync_worker *worker)
 {
 	struct istream *input = worker->msg_get_data.input;
@@ -137,6 +144,13 @@
 	   input as commands. make sure saving read everything. */
 	while ((i_stream_read_data(input, &data, &size, 0)) > 0)
 		i_stream_skip(input, size);
+
+	/* some input may already be buffered */
+	if (worker->to_input == NULL) {
+		worker->to_input =
+			timeout_add(0, proxy_client_worker_timeout_input,
+				    worker);
+	}
 }
 
 static bool
@@ -356,6 +370,8 @@
 		(struct proxy_client_dsync_worker *)_worker;
 
 	timeout_remove(&worker->to);
+	if (worker->to_input != NULL)
+		timeout_remove(&worker->to_input);
 	if (worker->io != NULL)
 		io_remove(&worker->io);
 	i_stream_destroy(&worker->input);


More information about the dovecot-cvs mailing list