mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
REORG: startup: move on_new_child_failure in mworker.c
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.
This commit is contained in:
parent
321c021a83
commit
af642420b4
@ -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)
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user