summaryrefslogtreecommitdiff
path: root/res/res_pjsip/pjsip_configuration.c
diff options
context:
space:
mode:
authorGeorge Joseph <george.joseph@fairview5.com>2016-02-09 16:34:05 -0700
committerGeorge Joseph <george.joseph@fairview5.com>2016-02-11 18:44:53 -0600
commitb1b797e0e75231e1669f9f7e17cc3032657c24cb (patch)
treee217067d873126be9dfe50e30cd1160d4db519a8 /res/res_pjsip/pjsip_configuration.c
parent8c15f309c2c4c9979727366f4d1263f5bddf5aa0 (diff)
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
Diffstat (limited to 'res/res_pjsip/pjsip_configuration.c')
-rw-r--r--res/res_pjsip/pjsip_configuration.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index d4473ff63..1eed9284b 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -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);
}