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

Function dr_reload_cmd_1

modules/drouting/drouting.c:2406–2442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2404}
2405
2406mi_response_t *dr_reload_cmd_1(const mi_params_t *params,
2407 struct mi_handler *async_hdl)
2408{
2409 struct head_db *part;
2410 mi_response_t *resp;
2411 int is_inherit_state = get_mi_bool_like_param(params, "inherit_state", 1);
2412
2413 LM_INFO("dr_reload MI command received!\n");
2414
2415 resp = mi_dr_get_partition(params, &part);
2416 if (resp)
2417 return resp;
2418
2419 switch (dr_reload_data_head(part, &part->partition, 0, is_inherit_state)) {
2420 case 0:
2421 /* all good, fallback to reloading */
2422 break;
2423 case 1:
2424 return init_mi_error(404, MI_SSTR("No rules tables"));
2425 case -2:
2426 return init_mi_error(500, MI_SSTR("Reload in progress"));
2427 case -1:
2428 default:
2429 LM_CRIT("Failed to load data head\n");
2430 return init_mi_error(500, MI_SSTR("Failed to reload"));
2431 }
2432
2433 /* put the new part in use within qrouting */
2434 lock_start_write(reload_lock);
2435 run_dr_cbs(DRCB_RLD_FINALIZE, NULL);
2436 lock_stop_write(reload_lock);
2437
2438 if (dr_cluster_id && dr_cluster_sync() < 0)
2439 return init_mi_error(500, MI_SSTR("Failed to synchronize from cluster"));
2440
2441 return init_mi_result_ok();
2442}
2443
2444
2445static inline int get_group_id(struct sip_uri *uri, struct head_db *

Callers

nothing calls this directly

Calls 6

get_mi_bool_like_paramFunction · 0.85
mi_dr_get_partitionFunction · 0.85
dr_reload_data_headFunction · 0.85
init_mi_errorFunction · 0.85
run_dr_cbsFunction · 0.85
dr_cluster_syncFunction · 0.85

Tested by

no test coverage detected