diff options
author | Corey Farrell <git@cfware.com> | 2018-02-16 22:11:42 -0500 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2018-03-14 05:20:12 -0400 |
commit | 572a508ef2ae7cd86e0ffd8ad6d1c5997e988c26 (patch) | |
tree | a0dcfa18f8a4a9d3e87eac3b2a7df33ac2fbcad6 /main/manager.c | |
parent | fee929c8acd788a77982b537953bf4053242057e (diff) |
loader: Convert reload_classes to built-in modules.
* acl (named_acl.c)
* cdr
* cel
* ccss
* dnsmgr
* dsp
* enum
* extconfig (config.c)
* features
* http
* indications
* logger
* manager
* plc
* sounds
* udptl
These modules are now loaded at appropriate time by the module loader.
Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so
the module loader will abort startup on failure of these modules.
Some of these modules are still initialized or shutdown from outside the
module loader. logger.c is initialized very early and shutdown very
late, manager.c is initialized by the module loader but is shutdown by
the Asterisk core (too much uses it without holding references).
Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
Diffstat (limited to 'main/manager.c')
-rw-r--r-- | main/manager.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/main/manager.c b/main/manager.c index b698702af..64b07d319 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2710,6 +2710,8 @@ static char *handle_showmaneventq(struct ast_cli_entry *e, int cmd, struct ast_c return CLI_SUCCESS; } +static int reload_module(void); + /*! \brief CLI command manager reload */ static char *handle_manager_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { @@ -2726,7 +2728,7 @@ static char *handle_manager_reload(struct ast_cli_entry *e, int cmd, struct ast_ if (a->argc > 2) { return CLI_SHOWUSAGE; } - reload_manager(); + reload_module(); return CLI_SUCCESS; } @@ -8971,8 +8973,6 @@ static int __init_manager(int reload, int by_external_config) #endif int res; - ast_register_cleanup(manager_shutdown); - res = STASIS_MESSAGE_TYPE_INIT(ast_manager_get_generic_type); if (res != 0) { return -1; @@ -9455,12 +9455,19 @@ static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, __init_manager(1, 1); } -int init_manager(void) +static int unload_module(void) +{ + return 0; +} + +static int load_module(void) { - return __init_manager(0, 0); + ast_register_cleanup(manager_shutdown); + + return __init_manager(0, 0) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS; } -int reload_manager(void) +static int reload_module(void) { return __init_manager(1, 0); } @@ -9557,3 +9564,12 @@ ast_manager_event_blob_create( return ev; } + +AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Asterisk Manager Interface", + .support_level = AST_MODULE_SUPPORT_CORE, + .load = load_module, + .unload = unload_module, + .reload = reload_module, + .load_pri = AST_MODPRI_CORE, + .requires = "http", +); |