changeset 16578:843208699cbc

lib-http: Don't assert-crash in case of somewhat unexpected failing connections.
author Timo Sirainen <tss@iki.fi>
date Wed, 10 Jul 2013 02:31:05 +0300
parents dee7822501b0
children 129ae6342b28
files src/lib-http/http-client-host.c
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-http/http-client-host.c	Wed Jul 10 01:44:40 2013 +0300
+++ b/src/lib-http/http-client-host.c	Wed Jul 10 02:31:05 2013 +0300
@@ -256,9 +256,14 @@
 {
 	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