]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
REORG: startup: move on_new_child_failure in mworker.c
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Fri, 22 Nov 2024 21:39:20 +0000 (22:39 +0100)
committerWilliam Lallemand <wlallemand@haproxy.com>
Mon, 25 Nov 2024 14:20:24 +0000 (15:20 +0100)
mworker_on_new_child_failure() performs some routines for the worker process,
if it has failed the reload. As it's called only in mworker_catch_sigchld()
from mworker.c, let's move mworker_on_new_child_failure() in mworker.c as well.
Like this it could also be declared as a static.

include/haproxy/global.h
src/haproxy.c
src/mworker.c

index d3cc12221a52c079ed43724412273b5e06b87b1c..40ec67af9571725fbdbc7efceaf5285318e9b52c 100644 (file)
@@ -68,7 +68,6 @@ void display_version();
 
 void mworker_accept_wrapper(int fd);
 void mworker_reload(int hardreload);
-void mworker_on_new_child_failure(void);
 
 /* to be used with warned and WARN_* */
 static inline int already_warned(unsigned int warning)
index 4b880b81cd6fb82b77ebccd1b2bfae81e09b35a0..25881ce90a08008c33c361f410aaa150236da1a7 100644 (file)
@@ -914,31 +914,6 @@ static void mworker_loop()
        run_thread_poll_loop(NULL);
 }
 
-/*
- * Performs some routines for the worker process, which has failed the reload,
- * updates the global load_status.
- */
-void mworker_on_new_child_failure()
-{
-       struct mworker_proc *child;
-
-       /* increment the number of failed reloads */
-       list_for_each_entry(child, &proc_list, list) {
-               child->failedreloads++;
-       }
-
-       /* do not keep unused FDs retrieved from the previous process */
-       sock_drop_unused_old_sockets();
-
-       usermsgs_clr(NULL);
-       load_status = 0;
-       ha_warning("Failed to load worker!\n");
-       /* the sd_notify API is not able to send a reload failure signal. So
-        * the READY=1 signal still need to be sent */
-       if (global.tune.options & GTUNE_USE_SYSTEMD)
-               sd_notify(0, "READY=1\nSTATUS=Reload failed!\n");
-}
-
 /*
  * Exit with an error message upon a master recovery mode failure.
  */
index ffd4840574418995e3bf43ad8bfb0a286fb66789..ebe032efd13ddbd28465693e6c09d5c47811cef2 100644 (file)
@@ -313,6 +313,31 @@ void mworker_catch_sigterm(struct sig_handler *sh)
        mworker_kill(sig);
 }
 
+/*
+ * Performs some routines for the worker process, which has failed the reload,
+ * updates the global load_status.
+ */
+static void mworker_on_new_child_failure()
+{
+       struct mworker_proc *child;
+
+       /* increment the number of failed reloads */
+       list_for_each_entry(child, &proc_list, list) {
+               child->failedreloads++;
+       }
+
+       /* do not keep unused FDs retrieved from the previous process */
+       sock_drop_unused_old_sockets();
+
+       usermsgs_clr(NULL);
+       load_status = 0;
+       ha_warning("Failed to load worker!\n");
+       /* the sd_notify API is not able to send a reload failure signal. So
+        * the READY=1 signal still need to be sent */
+       if (global.tune.options & GTUNE_USE_SYSTEMD)
+               sd_notify(0, "READY=1\nSTATUS=Reload failed!\n");
+}
+
 /*
  * Wait for every children to exit
  */