[asterisk-commits] rmudgett: branch 11 r376659 - in /branches/11: ./ addons/ apps/ pbx/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 27 14:38:27 CST 2012


Author: rmudgett
Date: Tue Nov 27 14:38:23 2012
New Revision: 376659

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376659
Log:
Remove unnecessary channel module references.

* Removed call to ast_module_user_hangup_all() in res_config_mysql.c since
it is effectively a noop.  No channels can attach a reference to that
module.

* Removed call to ast_module_user_hangup_all() in app_celgenuserevent.c.
The caller of unload_module() has already called it.

* Removed redundant channel module references in pbx_dundi.c.  The
registered dialplan function callback dispatchers for the read/read2/write
callbacks already reference the module before calling.

* pbx_dundi: Moved unregistering CLI commands, DUNDi switch, and dialplan
functions to the first thing the unload_module() does.  This will reduce
the chance of new channels using DUNDi services while the module is being
torn down.
........

Merged revisions 376657 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 376658 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    branches/11/   (props changed)
    branches/11/addons/res_config_mysql.c
    branches/11/apps/app_celgenuserevent.c
    branches/11/pbx/pbx_dundi.c

Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: branches/11/addons/res_config_mysql.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/addons/res_config_mysql.c?view=diff&rev=376659&r1=376658&r2=376659
==============================================================================
--- branches/11/addons/res_config_mysql.c (original)
+++ branches/11/addons/res_config_mysql.c Tue Nov 27 14:38:23 2012
@@ -1393,9 +1393,6 @@
 	ast_config_engine_deregister(&mysql_engine);
 	ast_verb(2, "MySQL RealTime unloaded.\n");
 
-	ast_module_user_hangup_all();
-
-	usleep(1);
 	AST_RWLIST_WRLOCK(&databases);
 	while ((cur = AST_RWLIST_REMOVE_HEAD(&databases, list))) {
 		mysql_close(&cur->handle);

Modified: branches/11/apps/app_celgenuserevent.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_celgenuserevent.c?view=diff&rev=376659&r1=376658&r2=376659
==============================================================================
--- branches/11/apps/app_celgenuserevent.c (original)
+++ branches/11/apps/app_celgenuserevent.c Tue Nov 27 14:38:23 2012
@@ -80,13 +80,8 @@
 
 static int unload_module(void)
 {
-	int res;
-
-	res = ast_unregister_application(app);
-
-	ast_module_user_hangup_all();
-
-	return res;
+	ast_unregister_application(app);
+	return 0;
 }
 
 static int load_module(void)

Modified: branches/11/pbx/pbx_dundi.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/pbx/pbx_dundi.c?view=diff&rev=376659&r1=376658&r2=376659
==============================================================================
--- branches/11/pbx/pbx_dundi.c (original)
+++ branches/11/pbx/pbx_dundi.c Tue Nov 27 14:38:23 2012
@@ -4069,7 +4069,6 @@
 {
 	int results;
 	int x;
-	struct ast_module_user *u;
 	struct dundi_result dr[MAX_RESULTS];
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(number);
@@ -4086,8 +4085,6 @@
 		return -1;
 	}
 
-	u = ast_module_user_add(chan);
-
 	parse = ast_strdupa(num);
 
 	AST_STANDARD_APP_ARGS(args, parse);
@@ -4110,8 +4107,6 @@
 		}
 	}
 
-	ast_module_user_remove(u);
-
 	return 0;
 }
 
@@ -4150,7 +4145,6 @@
 
 static int dundi_query_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
-	struct ast_module_user *u;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(number);
 		AST_APP_ARG(context);
@@ -4161,17 +4155,13 @@
 	struct dundi_result_datastore *drds;
 	struct ast_datastore *datastore;
 
-	u = ast_module_user_add(chan);
-
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "DUNDIQUERY requires an argument (number)\n");
-		ast_module_user_remove(u);
 		return -1;
 	}
 
 	if (!chan) {
 		ast_log(LOG_ERROR, "DUNDIQUERY can not be used without a channel!\n");
-		ast_module_user_remove(u);
 		return -1;
 	}
 
@@ -4186,7 +4176,6 @@
 		args.context = "e164";
 
 	if (!(drds = ast_calloc(1, sizeof(*drds)))) {
-		ast_module_user_remove(u);
 		return -1;
 	}
 
@@ -4195,7 +4184,6 @@
 
 	if (!(datastore = ast_datastore_alloc(&dundi_result_datastore_info, buf))) {
 		drds_destroy(drds);
-		ast_module_user_remove(u);
 		return -1;
 	}
 
@@ -4210,8 +4198,6 @@
 	ast_channel_lock(chan);
 	ast_channel_datastore_add(chan, datastore);
 	ast_channel_unlock(chan);
-
-	ast_module_user_remove(u);
 
 	return 0;
 }
@@ -4223,7 +4209,6 @@
 
 static int dundi_result_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
 {
-	struct ast_module_user *u;
 	AST_DECLARE_APP_ARGS(args,
 		AST_APP_ARG(id);
 		AST_APP_ARG(resultnum);
@@ -4234,8 +4219,6 @@
 	struct ast_datastore *datastore;
 	int res = -1;
 
-	u = ast_module_user_add(chan);
-
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "DUNDIRESULT requires an argument (id and resultnum)\n");
 		goto finish;
@@ -4290,8 +4273,6 @@
 		ast_log(LOG_WARNING, "Result number %u is not valid for DUNDi query results for ID %s!\n", num, args.id);
 
 finish:
-	ast_module_user_remove(u);
-
 	return res;
 }
 
@@ -4959,7 +4940,12 @@
 static int unload_module(void)
 {
 	pthread_t previous_netthreadid = netthreadid, previous_precachethreadid = precachethreadid, previous_clearcachethreadid = clearcachethreadid;
-	ast_module_user_hangup_all();
+
+	ast_cli_unregister_multiple(cli_dundi, ARRAY_LEN(cli_dundi));
+	ast_unregister_switch(&dundi_switch);
+	ast_custom_function_unregister(&dundi_function);
+	ast_custom_function_unregister(&dundi_query_function);
+	ast_custom_function_unregister(&dundi_result_function);
 
 	/* Stop all currently running threads */
 	dundi_shutdown = 1;
@@ -4976,11 +4962,6 @@
  		pthread_join(previous_clearcachethreadid, NULL);
  	}
 
-	ast_cli_unregister_multiple(cli_dundi, ARRAY_LEN(cli_dundi));
-	ast_unregister_switch(&dundi_switch);
-	ast_custom_function_unregister(&dundi_function);
-	ast_custom_function_unregister(&dundi_query_function);
-	ast_custom_function_unregister(&dundi_result_function);
 	close(netsocket);
 	io_context_destroy(io);
 	ast_sched_context_destroy(sched);




More information about the asterisk-commits mailing list