From 9434c5b43d359d722674766de71ce8295f326ff1 Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Wed, 8 Jan 2020 08:31:53 +0200 Subject: [PATCH] Timer process counting: Drop obsolete code The timer counting and timer status code reporting logic was reworked in caabbe53229bde (from N timer processes to 1+1, later 1+1+1), so the "init_timer_no" shared integer logic is no longer needed. (cherry picked from commit ed905d1a36fd0d7fb5b6461433f00c53e69c87cd) --- daemonize.c | 38 +------------------------------------- daemonize.h | 3 +-- main.c | 4 ++-- 3 files changed, 4 insertions(+), 41 deletions(-) diff --git a/daemonize.c b/daemonize.c index 081fbd99e1c..d79177327dc 100644 --- a/daemonize.c +++ b/daemonize.c @@ -66,7 +66,6 @@ char *startup_wdir = NULL; static int status_pipe[2]; -static int *init_timer_no; static enum opensips_states *osips_state = NULL; @@ -74,7 +73,7 @@ static enum opensips_states *osips_state = NULL; * proper status code returning * * must be called before any forking */ -int create_status_pipe( int no_timers ) +int create_status_pipe(void) { int rc; @@ -87,31 +86,9 @@ int create_status_pipe( int no_timers ) goto retry; LM_DBG("pipe created ? rc = %d, errno = %s\n",rc,strerror(errno)); - - if (no_timers) - return rc; - - /* also create SHM var which the attendent will use - * to notify us about the overall number of timers - * that need init - * - * at this point we do not know how many timers we will need */ - init_timer_no = shm_malloc(sizeof(int)); - if (!init_timer_no) { - LM_ERR("no more shm\n"); - return -1; - } - - *init_timer_no = 0; return rc; } -void inc_init_timer(void) -{ - LM_DBG("incrementing init timer no\n"); - (*init_timer_no)++; -} - /* attempts to send the val * status code to the waiting end */ int send_status_code(char val) @@ -181,19 +158,6 @@ int wait_for_all_children(void) return -1; } - /* we got this far, means everything went ok with - * SIP listeners and module procs - * - * still need to see if - * timers initialized ok */ - - for (i=0;i<*init_timer_no;i++) { - LM_DBG("waiting for timer\n"); - ret = wait_status_code(&rc); - if (ret < 0 || rc < 0 ) - return -1; - } - return 0; } diff --git a/daemonize.h b/daemonize.h index cfb70393062..7efd4ecdabf 100644 --- a/daemonize.h +++ b/daemonize.h @@ -37,10 +37,9 @@ int set_core_dump(int enable, unsigned int size); int send_status_code(char val); void clean_read_pipeend(void); void clean_write_pipeend(void); -int create_status_pipe(int no_timers); +int create_status_pipe(void); int wait_for_one_child(void); int wait_for_all_children(void); -void inc_init_timer(void); enum opensips_states {STATE_NONE, STATE_STARTING, STATE_RUNNING, STATE_TERMINATING}; diff --git a/main.c b/main.c index 2d5520c5fbb..cc5de2692f0 100644 --- a/main.c +++ b/main.c @@ -855,7 +855,7 @@ static int main_loop(void) if (auto_scaling_enabled) { /* re-create the status pipes to collect the status of the * dynamically forked processes */ - if (create_status_pipe(1) < 0) { + if (create_status_pipe() < 0) { LM_ERR("failed to create status pipe\n"); goto error; } @@ -1280,7 +1280,7 @@ int main(int argc, char** argv) goto error; } - if (create_status_pipe(0) < 0) { + if (create_status_pipe() < 0) { LM_ERR("failed to create status pipe\n"); goto error; }