]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: Don't assert-crash in case of somewhat unexpected failing connections.
authorTimo Sirainen <tss@iki.fi>
Tue, 9 Jul 2013 23:31:05 +0000 (02:31 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 9 Jul 2013 23:31:05 +0000 (02:31 +0300)
src/lib-http/http-client-host.c

index 74a220a2bfd88646c7c1a3de55c007449ec96bfc..36095a8fd84e579089b009523a1deacd3b3c6f90 100644 (file)
@@ -256,9 +256,14 @@ http_client_host_port_connection_failure(struct http_client_host_port *hport,
 {
        struct http_client_host *host = hport->host;
 
-       i_assert(hport->pending_connection_count > 0);
-       if (--hport->pending_connection_count > 0)
-               return TRUE;
+       if (hport->pending_connection_count > 0) {
+               /* we're still doing the initial connections to this hport. if
+                  we're also doing parallel connections with soft timeouts
+                  (pending_connection_count>1), wait for them to finish
+                  first. */
+               if (--hport->pending_connection_count > 0)
+                       return TRUE;
+       }
 
        /* one of the connections failed. if we're not using soft timeouts,
           we need to try to connect to the next IP. if we are using soft