]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: backend: search conn in idle tree after safe on always reuse
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Mon, 25 Jan 2021 13:43:17 +0000 (14:43 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Fri, 12 Feb 2021 11:33:05 +0000 (12:33 +0100)
With http-reuse always, if no matching safe connection is found, check
in idle tree for a matching one. This is needed because now idle
connections can be differentiated from each other.

If only the safe tree was checked because not empty, but did not contain
a matching connection, we could miss matching entry in idle tree.

src/backend.c

index d561b821c4daf3a5935af878f083dc39aa80a6b1..c7fb3496d0a5bfb9a9b0a0760cebef6431674608 100644 (file)
@@ -1306,8 +1306,15 @@ int connect_server(struct stream *s)
                                /* search for a safe conn */
                                if (safe)
                                        srv_conn = conn_backend_get(s, srv, 1, hash);
-                               else if (reuse_mode == PR_O_REUSE_ALWS && idle)
+
+                               /* search for an idle conn if no safe conn found
+                                * on always reuse mode */
+                               if (!srv_conn &&
+                                   reuse_mode == PR_O_REUSE_ALWS && idle) {
+                                       /* TODO conn_backend_get should not check the
+                                        * safe list is this case */
                                        srv_conn = conn_backend_get(s, srv, 0, hash);
+                               }
                        }
 
                        if (srv_conn)