mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 16:33:34 +00:00
res_pjsip: Refactor load_module/unload_module
load_module was just too hairy with every step having to clean up all previous steps on failure. Some of the pjproject init calls have now been moved to a separate load_pjsip function and the unload_pjsip function was enhanced to clean up everything if an error happened at any stage of the load process. In the process, a bunch of missing pj_shutdowns, serializer_pool_shutdowns and ast_threadpool_shutdowns were also corrected. Change-Id: I5eec711b437c35b56605ed99537ebbb30463b302
This commit is contained in:
@@ -2026,18 +2026,24 @@ int ast_res_pjsip_initialize_configuration(const struct ast_module_info *ast_mod
|
||||
|
||||
void ast_res_pjsip_destroy_configuration(void)
|
||||
{
|
||||
if (!sip_sorcery) {
|
||||
return;
|
||||
}
|
||||
|
||||
ast_sorcery_observer_remove(sip_sorcery, CONTACT_STATUS, &state_contact_status_observer);
|
||||
ast_sorcery_observer_remove(sip_sorcery, "contact", &state_contact_observer);
|
||||
ast_sip_destroy_sorcery_global();
|
||||
ast_sip_destroy_sorcery_location();
|
||||
ast_sip_destroy_sorcery_auth();
|
||||
ast_sip_destroy_sorcery_transport();
|
||||
ast_sorcery_unref(sip_sorcery);
|
||||
sip_sorcery = NULL;
|
||||
ast_manager_unregister(AMI_SHOW_ENDPOINT);
|
||||
ast_manager_unregister(AMI_SHOW_ENDPOINTS);
|
||||
ast_cli_unregister_multiple(cli_commands, ARRAY_LEN(cli_commands));
|
||||
ast_sip_unregister_cli_formatter(endpoint_formatter);
|
||||
ast_sip_unregister_cli_formatter(channel_formatter);
|
||||
ast_sorcery_unref(sip_sorcery);
|
||||
ast_sip_destroy_cli();
|
||||
ao2_cleanup(persistent_endpoints);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user