Skip to content

Commit ed905d1

Browse files
committed
Timer process counting: Drop obsolete code
The timer counting and timer status code reporting logic was reworked in caabbe5 (from N timer processes to 1+1, later 1+1+1), so the "init_timer_no" shared integer logic is no longer needed.
1 parent 1137233 commit ed905d1

File tree

3 files changed

+4
-41
lines changed

3 files changed

+4
-41
lines changed

daemonize.c

+1-37
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,14 @@
6666
char *startup_wdir = NULL;
6767

6868
static int status_pipe[2];
69-
static int *init_timer_no;
7069

7170
static enum opensips_states *osips_state = NULL;
7271

7372
/* creates the status pipe which will be used for
7473
* proper status code returning
7574
*
7675
* must be called before any forking */
77-
int create_status_pipe( int no_timers )
76+
int create_status_pipe(void)
7877
{
7978
int rc;
8079

@@ -87,31 +86,9 @@ int create_status_pipe( int no_timers )
8786
goto retry;
8887

8988
LM_DBG("pipe created ? rc = %d, errno = %s\n",rc,strerror(errno));
90-
91-
if (no_timers)
92-
return rc;
93-
94-
/* also create SHM var which the attendent will use
95-
* to notify us about the overall number of timers
96-
* that need init
97-
*
98-
* at this point we do not know how many timers we will need */
99-
init_timer_no = shm_malloc(sizeof(int));
100-
if (!init_timer_no) {
101-
LM_ERR("no more shm\n");
102-
return -1;
103-
}
104-
105-
*init_timer_no = 0;
10689
return rc;
10790
}
10891

109-
void inc_init_timer(void)
110-
{
111-
LM_DBG("incrementing init timer no\n");
112-
(*init_timer_no)++;
113-
}
114-
11592
/* attempts to send the val
11693
* status code to the waiting end */
11794
int send_status_code(char val)
@@ -181,19 +158,6 @@ int wait_for_all_children(void)
181158
return -1;
182159
}
183160

184-
/* we got this far, means everything went ok with
185-
* SIP listeners and module procs
186-
*
187-
* still need to see if
188-
* timers initialized ok */
189-
190-
for (i=0;i<*init_timer_no;i++) {
191-
LM_DBG("waiting for timer\n");
192-
ret = wait_status_code(&rc);
193-
if (ret < 0 || rc < 0 )
194-
return -1;
195-
}
196-
197161
return 0;
198162
}
199163

daemonize.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,9 @@ int set_core_dump(int enable, unsigned int size);
3737
int send_status_code(char val);
3838
void clean_read_pipeend(void);
3939
void clean_write_pipeend(void);
40-
int create_status_pipe(int no_timers);
40+
int create_status_pipe(void);
4141
int wait_for_one_child(void);
4242
int wait_for_all_children(void);
43-
void inc_init_timer(void);
4443

4544
enum opensips_states {STATE_NONE, STATE_STARTING,
4645
STATE_RUNNING, STATE_TERMINATING};

main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,7 @@ static int main_loop(void)
856856
if (auto_scaling_enabled) {
857857
/* re-create the status pipes to collect the status of the
858858
* dynamically forked processes */
859-
if (create_status_pipe(1) < 0) {
859+
if (create_status_pipe() < 0) {
860860
LM_ERR("failed to create status pipe\n");
861861
goto error;
862862
}
@@ -1281,7 +1281,7 @@ int main(int argc, char** argv)
12811281
goto error;
12821282
}
12831283

1284-
if (create_status_pipe(0) < 0) {
1284+
if (create_status_pipe() < 0) {
12851285
LM_ERR("failed to create status pipe\n");
12861286
goto error;
12871287
}

0 commit comments

Comments
 (0)