]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp proxy: Avoid hanging at the end of message input.
authorTimo Sirainen <tss@iki.fi>
Mon, 4 Oct 2010 16:10:08 +0000 (17:10 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 4 Oct 2010 16:10:08 +0000 (17:10 +0100)
src/lmtp/lmtp-proxy.c

index fc021ceb034aca00f361c0cf814557ed5a7d57ca..82794ec274f990dec77c394200062ecd9a844bc0 100644 (file)
@@ -378,6 +378,14 @@ static void lmtp_proxy_wait_for_output(struct lmtp_proxy *proxy)
        }
 }
 
+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 @@ static bool lmtp_proxy_data_read(struct lmtp_proxy *proxy)
                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 bool lmtp_proxy_data_read(struct lmtp_proxy *proxy)
 
 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;
 }