Skip to content

Commit af64242

Browse files
einval22wlallemand
authored andcommitted
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.
1 parent 321c021 commit af64242

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

include/haproxy/global.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ void display_version();
6868

6969
void mworker_accept_wrapper(int fd);
7070
void mworker_reload(int hardreload);
71-
void mworker_on_new_child_failure(void);
7271

7372
/* to be used with warned and WARN_* */
7473
static inline int already_warned(unsigned int warning)

src/haproxy.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -914,31 +914,6 @@ static void mworker_loop()
914914
run_thread_poll_loop(NULL);
915915
}
916916

917-
/*
918-
* Performs some routines for the worker process, which has failed the reload,
919-
* updates the global load_status.
920-
*/
921-
void mworker_on_new_child_failure()
922-
{
923-
struct mworker_proc *child;
924-
925-
/* increment the number of failed reloads */
926-
list_for_each_entry(child, &proc_list, list) {
927-
child->failedreloads++;
928-
}
929-
930-
/* do not keep unused FDs retrieved from the previous process */
931-
sock_drop_unused_old_sockets();
932-
933-
usermsgs_clr(NULL);
934-
load_status = 0;
935-
ha_warning("Failed to load worker!\n");
936-
/* the sd_notify API is not able to send a reload failure signal. So
937-
* the READY=1 signal still need to be sent */
938-
if (global.tune.options & GTUNE_USE_SYSTEMD)
939-
sd_notify(0, "READY=1\nSTATUS=Reload failed!\n");
940-
}
941-
942917
/*
943918
* Exit with an error message upon a master recovery mode failure.
944919
*/

src/mworker.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,31 @@ void mworker_catch_sigterm(struct sig_handler *sh)
313313
mworker_kill(sig);
314314
}
315315

316+
/*
317+
* Performs some routines for the worker process, which has failed the reload,
318+
* updates the global load_status.
319+
*/
320+
static void mworker_on_new_child_failure()
321+
{
322+
struct mworker_proc *child;
323+
324+
/* increment the number of failed reloads */
325+
list_for_each_entry(child, &proc_list, list) {
326+
child->failedreloads++;
327+
}
328+
329+
/* do not keep unused FDs retrieved from the previous process */
330+
sock_drop_unused_old_sockets();
331+
332+
usermsgs_clr(NULL);
333+
load_status = 0;
334+
ha_warning("Failed to load worker!\n");
335+
/* the sd_notify API is not able to send a reload failure signal. So
336+
* the READY=1 signal still need to be sent */
337+
if (global.tune.options & GTUNE_USE_SYSTEMD)
338+
sd_notify(0, "READY=1\nSTATUS=Reload failed!\n");
339+
}
340+
316341
/*
317342
* Wait for every children to exit
318343
*/

0 commit comments

Comments
 (0)