dovecot-2.0: lmtp proxy: Avoid hanging at the end of message input.

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 4 19:10:17 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/1f784904111b
changeset: 12240:1f784904111b
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 04 17:10:08 2010 +0100
description:
lmtp proxy: Avoid hanging at the end of message input.

diffstat:

 src/lmtp/lmtp-proxy.c |  15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diffs (43 lines):

diff -r 45812039b7ce -r 1f784904111b src/lmtp/lmtp-proxy.c
--- a/src/lmtp/lmtp-proxy.c	Mon Oct 04 16:01:09 2010 +0100
+++ b/src/lmtp/lmtp-proxy.c	Mon Oct 04 17:10:08 2010 +0100
@@ -378,6 +378,14 @@
 	}
 }
 
+static void proxy_send_more(struct lmtp_proxy *proxy)
+{
+	struct lmtp_proxy_connection *const *conns;
+
+	array_foreach(&proxy->connections, conns)
+		lmtp_client_send_more((*conns)->client);
+}
+
 static bool lmtp_proxy_data_read(struct lmtp_proxy *proxy)
 {
 	size_t size;
@@ -404,6 +412,8 @@
 		if (proxy->data_input->stream_errno != 0)
 			lmtp_proxy_fail_all(proxy, "disconnect");
 		else {
+			/* make sure LMTP clients see the EOF */
+			proxy_send_more(proxy);
 			/* finished reading data input. now we'll just have to
 			   wait for replies. */
 			lmtp_proxy_wait_for_output(proxy);
@@ -423,14 +433,11 @@
 
 static void lmtp_proxy_data_input(struct lmtp_proxy *proxy)
 {
-	struct lmtp_proxy_connection *const *conns;
-
 	i_assert(!proxy->handling_data_input);
 
 	proxy->handling_data_input = TRUE;
 	do {
-		array_foreach(&proxy->connections, conns)
-			lmtp_client_send_more((*conns)->client);
+		proxy_send_more(proxy);
 	} while (lmtp_proxy_data_read(proxy));
 	proxy->handling_data_input = FALSE;
 }


More information about the dovecot-cvs mailing list