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

Function routes_switch_per_proc

cfg_reload.c:315–355  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

313
314
315static void routes_switch_per_proc(int sender, void *param)
316{
317 int seq_no = (int)(long)param;
318
319 LM_DBG("swich cmd received in process %d, with seq no %d\n",
320 process_no, seq_no);
321
322 if (srr_ctx->seq_no!=0 && srr_ctx->seq_no!=seq_no) {
323 LM_INFO("dropping switch cmd due out of sequence reason\n");
324 if (parsed_sr) free_route_lists(parsed_sr);
325 parsed_sr = NULL;
326 return;
327 }
328
329 /* handle the async fd - mark them and see if we have any; if yes,
330 * then we need to keep the previous cfg until all the async are done */
331 reactor_set_app_flag( F_SCRIPT_ASYNC, REACTOR_RELOAD_TAINTED_FLAG);
332 reactor_set_app_flag( F_FD_ASYNC, REACTOR_RELOAD_TAINTED_FLAG);
333 reactor_set_app_flag( F_LAUNCH_ASYNC, REACTOR_RELOAD_TAINTED_FLAG);
334
335 if (reactor_check_app_flag(REACTOR_RELOAD_TAINTED_FLAG)) {
336 /* we do have onlgoing aync fds */
337 LM_DBG("keeping previous cfg until all ongoing async complete\n");
338 prev_sr = sroutes;
339 _have_old_script = 1;
340 } else {
341 /* we can get rid of the script right away*/
342 LM_DBG("no ongoing async, freeing the previous cfg\n");
343 free_route_lists(sroutes);
344 prev_sr = NULL;
345 _have_old_script = 0;
346 }
347
348 /* swap the old route set with the new parsed set */
349 sroutes = parsed_sr;
350 parsed_sr = NULL;
351
352 /* update all the ref to script routes */
353 update_all_script_route_refs();
354 print_script_route_refs();
355}
356
357
358int self_update_routing_script(void)

Callers 1

Calls 3

free_route_listsFunction · 0.85
print_script_route_refsFunction · 0.85

Tested by

no test coverage detected