]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lmtp proxy: Stalling remote servers weren't detected correctly.
authorTimo Sirainen <tss@iki.fi>
Mon, 23 Nov 2009 20:43:33 +0000 (15:43 -0500)
committerTimo Sirainen <tss@iki.fi>
Mon, 23 Nov 2009 20:43:33 +0000 (15:43 -0500)
--HG--
branch : HEAD

src/lmtp/lmtp-proxy.c

index 553b5931c1934b1ff815dfe8f2f55a29428a2ac6..eedba74512f4f906c3cba013ddeef7071157e27a 100644 (file)
@@ -374,6 +374,16 @@ static bool lmtp_proxy_data_read(struct lmtp_proxy *proxy)
        timeout_reset(proxy->to_data_idle);
 
        switch (i_stream_read(proxy->data_input)) {
+       case 0:
+               if (!tee_i_stream_child_is_waiting(proxy->data_input)) {
+                       /* nothing new read */
+                       if (proxy->io != NULL)
+                               return FALSE;
+                       proxy->io = io_add(i_stream_get_fd(proxy->data_input),
+                                          IO_READ,
+                                          lmtp_proxy_data_input, proxy);
+               }
+               /* fall through */
        case -2:
                /* buffer full. someone's stalling. */
                lmtp_proxy_wait_for_output(proxy);
@@ -389,14 +399,6 @@ static bool lmtp_proxy_data_read(struct lmtp_proxy *proxy)
                        lmtp_proxy_try_finish(proxy);
                }
                return FALSE;
-       case 0:
-               /* nothing new read */
-               if (proxy->io == NULL) {
-                       proxy->io = io_add(i_stream_get_fd(proxy->data_input),
-                                          IO_READ,
-                                          lmtp_proxy_data_input, proxy);
-               }
-               return FALSE;
        default:
                /* something was read */
                (void)i_stream_get_data(proxy->data_input, &size);