]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: peers: fix logical "and" when checking for local in PEER_APP_ST_STARTING
authorWilly Tarreau <w@1wt.eu>
Mon, 27 Apr 2026 12:30:45 +0000 (14:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 27 Apr 2026 12:44:29 +0000 (14:44 +0200)
The expression to check both peer->local and appctx_is_back() uses a
bitwise '&' instead of a logical '&&'. Fortunately both values are
always either 0 or 1 so there is no impact. This can be backported to
all stable versions.

src/peers.c

index 2390880bb661ce2630d179c88e81c0412346859a..855aaa948f34ed3c5a6cc14b14240b669a7e012b 100644 (file)
@@ -3571,7 +3571,7 @@ static void sync_peer_app_state(struct peers *peers, struct peer *peer)
        }
        else if (peer->appstate == PEER_APP_ST_STARTING) {
                clear_peer_learning_status(peer);
-               if (peer->local & appctx_is_back(peer->appctx)) {
+               if (peer->local && appctx_is_back(peer->appctx)) {
                        /* if local peer has accepted the connection (appctx is
                         * on the backend side), flag it to learn a lesson and
                         * be sure it will start immediately. This only happens