summaryrefslogtreecommitdiff
path: root/res/res_pjsip
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 19:05:11 -0700
commitb37555cc94d1f82365116e6555a214f15e3f0a0d (patch)
tree7359ed20f84752c9ef018ea2da424dc7b5842c13 /res/res_pjsip
parenta39486552efb30ca4067d0b8e919ed03f332b4af (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')
-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 4afa9507d..2a81cfded 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -2024,18 +2024,24 @@ int ast_res_pjsip_initialize_configuration(void)
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);
}