MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / start_timer_extra_processes

Function start_timer_extra_processes

timer.c:914–962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

912
913
914int start_timer_extra_processes(int *chd_rank)
915{
916 int i, p_id;
917 const struct internal_fork_params ifp_th = {
918 .proc_desc = "Timer handler",
919 .flags = OSS_PROC_NEEDS_SCRIPT,
920 .type = TYPE_TIMER,
921 };
922
923 if (auto_scaling_enabled && s_profile &&
924 create_process_group( TYPE_TIMER, NULL, s_profile ,
925 fork_dynamic_timer_process, timer_process_graceful_terminate)!=0)
926 LM_ERR("failed to create group of TIMER processes, "
927 "auto forking will not be possible\n");
928
929 for( i=0 ; i<timer_workers_no ; i++ ) {
930
931 (*chd_rank)++;
932 if ( (p_id=internal_fork(&ifp_th))<0 ) {
933 LM_CRIT("cannot fork Timer handler process\n");
934 return -1;
935 } else if (p_id==0) {
936 /* new Timer process */
937 /* set a more detailed description */
938 set_proc_attrs("Timer handler");
939 if (timer_proc_reactor_init() < 0 ||
940 init_child(*chd_rank) < 0) {
941 report_failure_status();
942 goto error;
943 }
944
945 report_conditional_status( (!no_daemon_mode), 0);
946
947 /* launch the reactor */
948 reactor_main_loop( 1/*timeout in sec*/, error , );
949 destroy_worker_reactor();
950
951 exit(-1);
952 }
953 /*parent*/
954
955 }
956
957 return 0;
958
959/* only from child process */
960error:
961 exit(-1);
962}
963
964
965void handle_timer_job(void)

Callers 1

main_loopFunction · 0.85

Calls 5

create_process_groupFunction · 0.85
internal_forkFunction · 0.85
set_proc_attrsFunction · 0.85
timer_proc_reactor_initFunction · 0.85
init_childFunction · 0.85

Tested by

no test coverage detected