]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker: add and set state PROC_O_INIT for new worker
authorValentine Krasnobaeva <vkrasnobaeva@haproxy.com>
Wed, 9 Oct 2024 13:44:25 +0000 (15:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 16 Oct 2024 20:02:39 +0000 (22:02 +0200)
Here, to distinguish between the new worker and the previous one let's add a
new process state PROC_O_INIT and let's set it, when the memory is allocated
for the new worker in the processes list.

include/haproxy/mworker-t.h
src/haproxy.c

index 3137ec0be9c97a29dc5dab7154b7751b92199665..46e125f36f1994a4a75020d1ace410318f96c140 100644 (file)
@@ -24,7 +24,9 @@
 #define PROC_O_TYPE_PROG             0x00000004
 /* 0x00000008 unused */
 #define PROC_O_LEAVING               0x00000010  /* this process should be leaving */
-/* 0x00000020 to 0x00000080 unused */
+/* state of the newly forked worker process, which hasn't sent yet its READY message to master */
+#define PROC_O_INIT                  0x00000020
+/* 0x00000040 to 0x00000080 unused */
 #define PROC_O_START_RELOAD          0x00000100  /* Start the process even if the master was re-executed */
 
 /*
index e9198704b652bd2d4fc17b542354b163a1af02c4..c6107e0daef41bd029d170378a0fd892534c2e36 100644 (file)
@@ -2095,8 +2095,8 @@ static void init(int argc, char **argv)
                        ha_alert("Cannot allocate process structures.\n");
                        exit(EXIT_FAILURE);
                }
-               tmproc->options |= PROC_O_TYPE_WORKER; /* worker */
-
+               /* worker */
+               tmproc->options |= (PROC_O_TYPE_WORKER | PROC_O_INIT);
                /* create a sockpair to copy it via fork(), thus it will be in
                 * master and in worker processes
                 */