]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: server: ensure check-reuse-pool is init in srv_settings_init()
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 29 Jul 2026 09:32:27 +0000 (11:32 +0200)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 29 Jul 2026 13:21:35 +0000 (15:21 +0200)
For rHTTP servers, check-reuse-pool is forcefully set on them, else
checks would always fail. This initialization was performed in
_srv_parse_init().

Move this force init in srv_settings_init(). This is a better place as
_srv_parse_init() should only perform minimal configuration, mostly
related to server address. Then srv_settings_init() is called with the
task to set every fields to suitable default values before keywords
parsing.

Also, this ensures that check-reuse-pool is set to 0 for non rHTTP
servers. This is not strictly required though as server structure is
calloc'ed.

src/server.c

index a28b2dba4abd235885397a34bd875b2007a53059..76c8a25cc3ce4e2e9919b4402fd0f0c7468451c4 100644 (file)
@@ -2890,6 +2890,8 @@ void srv_settings_init(struct server *srv)
        srv->check.rise = DEF_RISETIME;
        srv->check.fall = DEF_FALLTIME;
        srv->check.port = 0;
+       /* Automatically activate check-reuse-pool for rhttp@ servers. */
+       srv->check.reuse_pool = srv->flags & SRV_F_RHTTP ? 1 : 0;
 
        srv->agent.inter = DEF_CHKINTR;
        srv->agent.fastinter = 0;
@@ -3797,8 +3799,6 @@ static int _srv_parse_init(struct server **srv, char **args, int *cur_arg,
                        }
                        else {
                                newsrv->flags |= SRV_F_RHTTP;
-                               /* Automatically activate check-reuse-pool for rhttp@ servers. */
-                               newsrv->check.reuse_pool = 1;
                        }
                }