summaryrefslogtreecommitdiff
path: root/main/core_local.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-03-26 22:24:26 +0000
committerCorey Farrell <git@cfware.com>2015-03-26 22:24:26 +0000
commit3ddd92902af9eaa3018f7e25e430afcfe4322845 (patch)
tree1ab68bf8be8af553138e4b6019bd74f87f5f48c5 /main/core_local.c
parentd7fc85e69d5dc23f27ec15dacaa03914ece64e42 (diff)
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 ........ Merged revisions 433497 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@433498 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/core_local.c')
-rw-r--r--main/core_local.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/main/core_local.c b/main/core_local.c
index 934cf86bf..8d8e6fc55 100644
--- a/main/core_local.c
+++ b/main/core_local.c
@@ -1006,14 +1006,6 @@ static void local_shutdown(void)
ast_manager_unregister("LocalOptimizeAway");
ast_channel_unregister(&local_tech);
- it = ao2_iterator_init(locals, 0);
- while ((p = ao2_iterator_next(&it))) {
- if (p->base.owner) {
- ast_softhangup(p->base.owner, AST_SOFTHANGUP_APPUNLOAD);
- }
- ao2_ref(p, -1);
- }
- ao2_iterator_destroy(&it);
ao2_ref(locals, -1);
locals = NULL;
@@ -1063,6 +1055,6 @@ int ast_local_init(void)
ast_cli_register_multiple(cli_local, ARRAY_LEN(cli_local));
ast_manager_register_xml_core("LocalOptimizeAway", EVENT_FLAG_SYSTEM|EVENT_FLAG_CALL, manager_optimize_away);
- ast_register_atexit(local_shutdown);
+ ast_register_cleanup(local_shutdown);
return 0;
}