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

Function dr_exit

modules/drouting/drouting.c:2306–2364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2304
2305
2306static int dr_exit(void)
2307{
2308 struct head_db * it = head_db_start, *to_clean;
2309
2310 while( it!=NULL ) {
2311 to_clean = it;
2312 it = it->next;
2313 if (dr_persistent_state && !to_clean->cache &&
2314 db_connect_head(to_clean)==0 ) {
2315 dr_state_flusher(to_clean);
2316
2317 (to_clean->db_funcs).close(*(to_clean->db_con));
2318 *(to_clean->db_con) = 0;
2319 pkg_free(to_clean->db_con);
2320 }
2321
2322 /* destroy data */
2323 if (to_clean->rdata && !to_clean->cache) {
2324 free_rt_data(to_clean->rdata, to_clean->free);
2325 to_clean->rdata = 0;
2326 }
2327
2328 /* destroy lock */
2329 if (to_clean->ref_lock) {
2330 lock_destroy_rw( to_clean->ref_lock );
2331 to_clean->ref_lock = 0;
2332 }
2333
2334 /* free table names stored in head_db */
2335 if(to_clean->drd_table.s && to_clean->drd_table.s != drd_table.s) {
2336 shm_free(to_clean->drd_table.s);
2337 }
2338
2339 if(to_clean->drr_table.s && to_clean->drr_table.s != drr_table.s) {
2340 shm_free(to_clean->drr_table.s);
2341 }
2342
2343 if(to_clean->drc_table.s && to_clean->drc_table.s != drc_table.s) {
2344 shm_free(to_clean->drc_table.s);
2345 }
2346
2347 if(to_clean->drg_table.s && to_clean->drg_table.s != drg_table.s) {
2348 shm_free(to_clean->drg_table.s);
2349 }
2350
2351 shm_free(to_clean);
2352 }
2353
2354 if (dr_enable_probing_state)
2355 shm_free(dr_enable_probing_state);
2356
2357 /* destroy blacklists */
2358 destroy_dr_bls();
2359
2360 /* destroy all callbacks */
2361 destroy_dr_cbs();
2362
2363 return 0;

Callers

nothing calls this directly

Calls 7

dr_state_flusherFunction · 0.85
free_rt_dataFunction · 0.85
lock_destroy_rwFunction · 0.85
shm_freeFunction · 0.85
destroy_dr_blsFunction · 0.85
destroy_dr_cbsFunction · 0.85
db_connect_headFunction · 0.70

Tested by

no test coverage detected