]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MINOR: startup: split init() into separate initialization routines
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Mon, 7 Oct 2024 11:40:33 +0000 (13:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
commit49772c55e3b0b4d1958bf58a27325b45d5266ce6
tree7574cbd3a189167569a11c2521485cc216c809f2
parent81dbc2c2e27fbd312e956c873a7c3145edde1c87
MINOR: startup: split init() into separate initialization routines

This is the first commit in a series to add a support of the 5-th reload
use case, when the master process fails to read its new configuration. In this
case it just need to perform its initialization steps and keep the existed
worker.

To add the support for this last use case we need to split init() and main()
in a shorter steps in order to encapsulate necessary initialization routines
into separate functions.

Let's at first, make here progname as a global variable for haproxy.c, as it
will be used in error messages in the initialization functions. Then let's
split the init() into separate routines, which set and apply modes, write
process PID in a pidfile, etc.

The big part of the former init(), which called functions to allocate pools,
to initialize proxies, to calculate maxconn and to perform some post checks was
just encasulated as is, into step_init_2(). It will take some time to figure
out exactly which parts of this initialization block are really necessary for
the master process and which ones it could skip. So, for the moment
step_init_2() is called for all runtime modes.
src/haproxy.c