]> git.ipfire.org Git - thirdparty/haproxy.git/commit
CLEANUP: backend: factor the connection lookup loop
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Sep 2025 13:30:30 +0000 (15:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 16 Sep 2025 07:23:46 +0000 (09:23 +0200)
commit3d18a0d4c245fc9c0d97764e5b5bbfdc4011ddd5
treec357fb135cf25af92137a377eae8be51e67b64e9
parent7773d87ea6f9a17661be4c144bbe35e141d20a2e
CLEANUP: backend: factor the connection lookup loop

The connection lookup loop is made of two identical blocks, one looking
in the idle or safe lists and the other one looking into the safe list
only. The second one is skipped if a connection was found or if the request
looks for a safe one (since already done). Also the two are slightly
different due to leftovers from earlier versions in that the second one
checks for safe connections and not the first one, and the second one
sets is_safe which is not used later.

Let's just rationalize all this by placing them in a loop which checks
first from the idle conns and second from the safe ones, or skips the
first step if the request wants a safe connection. This reduces the
code and shortens the time spent under the lock.
src/backend.c