[Asterisk-code-review] res pjsip outbound publishing: After unloading the library w... (asterisk[13])

Joshua Colp asteriskteam at digium.com
Thu May 19 13:33:09 CDT 2016


Joshua Colp has submitted this change and it was merged.

Change subject: res_pjsip_outbound_publishing: After unloading the library won't load again
......................................................................


res_pjsip_outbound_publishing: After unloading the library won't load again

The same thing was happening in res_pjsip_publish_asterisk. When the library
was unloaded it did not unregister the object type from sorcery. Subsequent
loads resulted in a failed load due to the sorcery type already existing.

Change-Id: Ifdc25e94e4cd40bc5a19eb4d0a00b86c2e9fedc9
---
M res/res_pjsip_outbound_publish.c
M res/res_pjsip_publish_asterisk.c
2 files changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/res/res_pjsip_outbound_publish.c b/res/res_pjsip_outbound_publish.c
index 60f9bbb..073a2d1 100644
--- a/res/res_pjsip_outbound_publish.c
+++ b/res/res_pjsip_outbound_publish.c
@@ -1141,6 +1141,7 @@
 
 	if (ast_sorcery_object_register(ast_sip_get_sorcery(), "outbound-publish", sip_outbound_publish_alloc, NULL,
 		sip_outbound_publish_apply)) {
+		ast_log(LOG_ERROR, "Unable to register 'outbound-publish' type with sorcery\n");
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
@@ -1213,6 +1214,7 @@
 			"in the allowed time\n", unloading.count);
 	} else {
 		ast_verb(5, "All items successfully unpublished\n");
+		ast_sorcery_object_unregister(ast_sip_get_sorcery(), "outbound-publish");
 	}
 
 	return res;
diff --git a/res/res_pjsip_publish_asterisk.c b/res/res_pjsip_publish_asterisk.c
index 3218b0a..002d976 100644
--- a/res/res_pjsip_publish_asterisk.c
+++ b/res/res_pjsip_publish_asterisk.c
@@ -862,6 +862,7 @@
 	ast_sorcery_apply_default(ast_sip_get_sorcery(), "asterisk-publication", "config", "pjsip.conf,criteria=type=asterisk-publication");
 
 	if (ast_sorcery_object_register(ast_sip_get_sorcery(), "asterisk-publication", asterisk_publication_config_alloc, NULL, NULL)) {
+		ast_log(LOG_ERROR, "Unable to register 'asterisk-publication' type with sorcery\n");
 		return AST_MODULE_LOAD_DECLINE;
 	}
 
@@ -919,6 +920,7 @@
 	ast_sip_unregister_publish_handler(&asterisk_mwi_publication_handler);
 	ast_sip_unregister_event_publisher_handler(&asterisk_devicestate_publisher_handler);
 	ast_sip_unregister_event_publisher_handler(&asterisk_mwi_publisher_handler);
+	ast_sorcery_object_unregister(ast_sip_get_sorcery(), "asterisk-publication");
 	return 0;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/2805
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ifdc25e94e4cd40bc5a19eb4d0a00b86c2e9fedc9
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list