Fix the fix on unlimited connections.
[pazpar2-moved-to-github.git] / src / connection.c
index bfa764e..c2c5677 100644 (file)
@@ -504,16 +504,14 @@ int client_prep_connection(struct client *cl,
                         num_connections);
                 break;
             }
-            if (max_connections > 0) {
-                if (num_connections < max_connections)
-                {
-                    yaz_log(YLOG_LOG, "num_connections = %d (new); max = %d",
-                            num_connections, max_connections);
-                    break;
-                }
-                yaz_log(YLOG_LOG, "num_connections = %d (waiting) max = %d",
+            if (max_connections <= 0 || num_connections < max_connections)
+            {
+                yaz_log(YLOG_LOG, "num_connections = %d (new); max = %d",
                         num_connections, max_connections);
+                break;
             }
+            yaz_log(YLOG_LOG, "num_connections = %d (waiting) max = %d",
+                    num_connections, max_connections);
             if (yaz_cond_wait(host->cond_ready, host->mutex, abstime))
             {
                 yaz_log(YLOG_LOG, "out of connections %s", client_get_url(cl));