MINOR: backend: search conn in idle tree after safe on always reuse

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.
This commit is contained in:
Amaury Denoyelle 2021-01-25 14:43:17 +01:00
parent 1399d695c0
commit aa890aef3d

View 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)