From: Baptiste Assmann Date: Wed, 2 Nov 2016 14:33:15 +0000 (+0100) Subject: MINOR: init: move apply_server_state in haproxy.c before MODE_CHECK X-Git-Tag: v1.7-dev6~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4215d7d0336b40e934bb30f4524d4bbe58a8a5f6;p=thirdparty%2Fhaproxy.git MINOR: init: move apply_server_state in haproxy.c before MODE_CHECK Currently, the function which applies server states provided by the "old" process is applied after configuration sanity check. This results in the impossibility to check the validity of the state file during a regular config check, implying a full start is required, which can be a problem sometimes. This patch moves the loading of server_state file before MODE_CHECK. --- diff --git a/src/haproxy.c b/src/haproxy.c index 80d503086f..896d11693b 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -952,6 +952,12 @@ void init(int argc, char **argv) } #endif + /* Apply server states */ + apply_server_state(); + + for (px = proxy; px; px = px->next) + srv_compute_all_admin_states(px); + if (global.mode & MODE_CHECK) { struct peers *pr; struct proxy *px; @@ -973,12 +979,6 @@ void init(int argc, char **argv) exit(2); } - /* Apply server states */ - apply_server_state(); - - for (px = proxy; px; px = px->next) - srv_compute_all_admin_states(px); - global_listener_queue_task = task_new(); if (!global_listener_queue_task) { Alert("Out of memory when initializing global task\n");