mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
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
This commit is contained in:
27
main/ccss.c
27
main/ccss.c
@@ -4616,7 +4616,7 @@ static struct ast_cli_entry cc_cli[] = {
|
||||
AST_CLI_DEFINE(handle_cc_kill, "Kill a CC transaction"),
|
||||
};
|
||||
|
||||
static void cc_shutdown(void)
|
||||
static int unload_module(void)
|
||||
{
|
||||
ast_devstate_prov_del("ccss");
|
||||
ast_cc_agent_unregister(&generic_agent_callbacks);
|
||||
@@ -4642,30 +4642,32 @@ static void cc_shutdown(void)
|
||||
ao2_t_ref(generic_monitors, -1, "Unref generic_monitor container in cc_shutdown");
|
||||
generic_monitors = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ast_cc_init(void)
|
||||
static int load_module(void)
|
||||
{
|
||||
int res;
|
||||
|
||||
if (!(cc_core_instances = ao2_t_container_alloc(CC_CORE_INSTANCES_BUCKETS,
|
||||
cc_core_instance_hash_fn, cc_core_instance_cmp_fn,
|
||||
"Create core instance container"))) {
|
||||
return -1;
|
||||
return AST_MODULE_LOAD_FAILURE;
|
||||
}
|
||||
if (!(generic_monitors = ao2_t_container_alloc(CC_CORE_INSTANCES_BUCKETS,
|
||||
generic_monitor_instance_list_hash_fn, generic_monitor_instance_list_cmp_fn,
|
||||
"Create generic monitor container"))) {
|
||||
return -1;
|
||||
return AST_MODULE_LOAD_FAILURE;
|
||||
}
|
||||
if (!(cc_core_taskprocessor = ast_taskprocessor_get("CCSS_core", TPS_REF_DEFAULT))) {
|
||||
return -1;
|
||||
return AST_MODULE_LOAD_FAILURE;
|
||||
}
|
||||
if (!(cc_sched_context = ast_sched_context_create())) {
|
||||
return -1;
|
||||
return AST_MODULE_LOAD_FAILURE;
|
||||
}
|
||||
if (ast_sched_start_thread(cc_sched_context)) {
|
||||
return -1;
|
||||
return AST_MODULE_LOAD_FAILURE;
|
||||
}
|
||||
res = ast_register_application2(ccreq_app, ccreq_exec, NULL, NULL, NULL);
|
||||
res |= ast_register_application2(cccancel_app, cccancel_exec, NULL, NULL, NULL);
|
||||
@@ -4681,7 +4683,12 @@ int ast_cc_init(void)
|
||||
initialize_cc_devstate_map();
|
||||
res |= ast_devstate_prov_add("ccss", ccss_device_state);
|
||||
|
||||
ast_register_cleanup(cc_shutdown);
|
||||
|
||||
return res;
|
||||
return res ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS;
|
||||
}
|
||||
|
||||
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Call Completion Supplementary Services",
|
||||
.support_level = AST_MODULE_SUPPORT_CORE,
|
||||
.load = load_module,
|
||||
.unload = unload_module,
|
||||
.load_pri = AST_MODPRI_CORE,
|
||||
);
|
||||
|
Reference in New Issue
Block a user