MEDIUM: mworker-prog: implement program for master-worker
This patch implements the external binary support in the master worker.
To configure an external process, you need to use the program section,
for example:
program dataplane-api
command ./dataplane_api
Those processes are launched at the same time as the workers.
During a reload of HAProxy, those processes are dealing with the same
sequence as a worker:
- the master is re-executed
- the master sends a USR1 signal to the program
- the master launches a new instance of the program
During a stop, or restart, a SIGTERM is sent to the program.
diff --git a/src/haproxy.c b/src/haproxy.c
index b2bf558..ef52e31 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2841,6 +2841,8 @@
/* the father launches the required number of processes */
if (!(global.mode & MODE_MWORKER_WAIT)) {
+ if (global.mode & MODE_MWORKER)
+ mworker_ext_launch_all();
for (proc = 0; proc < global.nbproc; proc++) {
ret = fork();
if (ret < 0) {
@@ -2862,7 +2864,7 @@
/* find the right mworker_proc */
list_for_each_entry(child, &proc_list, list) {
if (child->relative_pid == relative_pid &&
- child->reloads == 0) {
+ child->reloads == 0 && child->type == 'w') {
child->timestamp = now.tv_sec;
child->pid = ret;
break;