From 2531f750576542037e93f4c4e087f9dbced1897d Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Wed, 11 Feb 2015 15:51:33 +0000 Subject: Enable REF_DEBUG for ast_module_ref / ast_module_unref. Add ast_module_shutdown_ref for use by modules that can only be unloaded during graceful shutdown. When REF_DEBUG is enabled: * Add an empty ao2 object to struct ast_module. * Allocate ao2 object when the module is loaded. * Perform an ao2_ref in each place where mod->usecount is manipulated. * ao2_cleanup on module unload. ASTERISK-24479 #close Reported by: Corey Farrell Review: https://reviewboard.asterisk.org/r/4141/ ........ Merged revisions 431662 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@431663 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- bridges/bridge_builtin_features.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bridges') diff --git a/bridges/bridge_builtin_features.c b/bridges/bridge_builtin_features.c index 8ba9a693d..d09a7a2ec 100644 --- a/bridges/bridge_builtin_features.c +++ b/bridges/bridge_builtin_features.c @@ -499,6 +499,10 @@ static int feature_hangup(struct ast_bridge_channel *bridge_channel, void *hook_ static int unload_module(void) { + ast_bridge_features_unregister(AST_BRIDGE_BUILTIN_HANGUP); + ast_bridge_features_unregister(AST_BRIDGE_BUILTIN_AUTOMON); + ast_bridge_features_unregister(AST_BRIDGE_BUILTIN_AUTOMIXMON); + return 0; } @@ -508,8 +512,8 @@ static int load_module(void) ast_bridge_features_register(AST_BRIDGE_BUILTIN_AUTOMON, feature_automonitor, NULL); ast_bridge_features_register(AST_BRIDGE_BUILTIN_AUTOMIXMON, feature_automixmonitor, NULL); - /* Bump up our reference count so we can't be unloaded */ - ast_module_ref(ast_module_info->self); + /* This module cannot be unloaded until shutdown */ + ast_module_shutdown_ref(ast_module_info->self); return AST_MODULE_LOAD_SUCCESS; } -- cgit v1.2.3