]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: init: move apply_server_state in haproxy.c before MODE_CHECK
authorBaptiste Assmann <bedis9@gmail.com>
Wed, 2 Nov 2016 14:33:15 +0000 (15:33 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 9 Nov 2016 13:24:20 +0000 (14:24 +0100)
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.

src/haproxy.c

index 80d503086f3449059491209f9cf636e8eb3c1a68..896d11693bcf4e4b56df9e019cf4b91d560e2205 100644 (file)
@@ -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");