mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-07 13:49:18 +00:00
Replace most uses of ast_register_atexit with ast_register_cleanup.
Since 'core stop now' and 'core restart now' do not stop modules, it is unsafe for most of the core to run cleanups. Originally all cleanups used ast_register_atexit, and were only changed when it was shown to be unsafe. ast_register_atexit is now used only when absolutely required to prevent corruption and close child processes. Exceptions that need to use ast_register_atexit: * CDR: Flush records. * res_musiconhold: Kill external applications. * AstDB: Close the DB. * canary_exit: Kill canary process. ASTERISK-24142 #close Reported by: David Brillert ASTERISK-24683 #close Reported by: Peter Katzmann ASTERISK-24805 #close Reported by: Badalian Vyacheslav ASTERISK-24881 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4500/ Review: https://reviewboard.asterisk.org/r/4501/ ........ Merged revisions 433495 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@433497 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
28
main/cel.c
28
main/cel.c
@@ -1513,10 +1513,7 @@ static void cel_engine_cleanup(void)
|
||||
destroy_routes();
|
||||
destroy_subscriptions();
|
||||
STASIS_MESSAGE_TYPE_CLEANUP(cel_generic_type);
|
||||
}
|
||||
|
||||
static void cel_engine_atexit(void)
|
||||
{
|
||||
ast_cli_unregister(&cli_status);
|
||||
aco_info_destroy(&cel_cfg_info);
|
||||
ao2_global_obj_release(cel_configs);
|
||||
@@ -1525,12 +1522,6 @@ static void cel_engine_atexit(void)
|
||||
ao2_global_obj_release(cel_backends);
|
||||
}
|
||||
|
||||
static void cel_engine_abort(void)
|
||||
{
|
||||
cel_engine_cleanup();
|
||||
cel_engine_atexit();
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Create the Stasis subscriptions for CEL
|
||||
*/
|
||||
@@ -1714,7 +1705,7 @@ int ast_cel_engine_init(void)
|
||||
ao2_global_obj_replace_unref(cel_linkedids, container);
|
||||
ao2_cleanup(container);
|
||||
if (!container) {
|
||||
cel_engine_abort();
|
||||
cel_engine_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1723,17 +1714,17 @@ int ast_cel_engine_init(void)
|
||||
ao2_global_obj_replace_unref(cel_dialstatus_store, container);
|
||||
ao2_cleanup(container);
|
||||
if (!container) {
|
||||
cel_engine_abort();
|
||||
cel_engine_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (STASIS_MESSAGE_TYPE_INIT(cel_generic_type)) {
|
||||
cel_engine_abort();
|
||||
cel_engine_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ast_cli_register(&cli_status)) {
|
||||
cel_engine_abort();
|
||||
cel_engine_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1741,12 +1732,12 @@ int ast_cel_engine_init(void)
|
||||
ao2_global_obj_replace_unref(cel_backends, container);
|
||||
ao2_cleanup(container);
|
||||
if (!container) {
|
||||
cel_engine_abort();
|
||||
cel_engine_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (aco_info_init(&cel_cfg_info)) {
|
||||
cel_engine_abort();
|
||||
cel_engine_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1759,7 +1750,7 @@ int ast_cel_engine_init(void)
|
||||
struct cel_config *cel_cfg = cel_config_alloc();
|
||||
|
||||
if (!cel_cfg) {
|
||||
cel_engine_abort();
|
||||
cel_engine_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1772,16 +1763,15 @@ int ast_cel_engine_init(void)
|
||||
}
|
||||
|
||||
if (create_subscriptions()) {
|
||||
cel_engine_abort();
|
||||
cel_engine_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ast_cel_check_enabled() && create_routes()) {
|
||||
cel_engine_abort();
|
||||
cel_engine_cleanup();
|
||||
return -1;
|
||||
}
|
||||
|
||||
ast_register_atexit(cel_engine_atexit);
|
||||
ast_register_cleanup(cel_engine_cleanup);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user