[asterisk-commits] file: trunk r355011 - in /trunk: ./ pbx/pbx_config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 13 13:56:04 CST 2012


Author: file
Date: Mon Feb 13 13:56:02 2012
New Revision: 355011

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=355011
Log:
Only allow one 'dialplan reload' to execute at a time as otherwise they would share the same common local context list.

(closes issue AST-758)
........

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

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

Modified:
    trunk/   (props changed)
    trunk/pbx/pbx_config.c

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

Modified: trunk/pbx/pbx_config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/pbx/pbx_config.c?view=diff&rev=355011&r1=355010&r2=355011
==============================================================================
--- trunk/pbx/pbx_config.c (original)
+++ trunk/pbx/pbx_config.c Mon Feb 13 13:56:02 2012
@@ -54,6 +54,8 @@
 static char *overrideswitch_config = NULL;
 
 AST_MUTEX_DEFINE_STATIC(save_dialplan_lock);
+
+AST_MUTEX_DEFINE_STATIC(reload_lock);
 
 static struct ast_context *local_contexts = NULL;
 static struct ast_hashtab *local_table = NULL;
@@ -1776,17 +1778,23 @@
 {
 	struct ast_context *con;
 
+	ast_mutex_lock(&reload_lock);
+
 	if (!local_table)
 		local_table = ast_hashtab_create(17, ast_hashtab_compare_contexts, ast_hashtab_resize_java, ast_hashtab_newsize_java, ast_hashtab_hash_contexts, 0);
 
-	if (!pbx_load_config(config))
+	if (!pbx_load_config(config)) {
+		ast_mutex_unlock(&reload_lock);
 		return AST_MODULE_LOAD_DECLINE;
+	}
 	
 	pbx_load_users();
 
 	ast_merge_contexts_and_delete(&local_contexts, local_table, registrar);
 	local_table = NULL; /* the local table has been moved into the global one. */
 	local_contexts = NULL;
+
+	ast_mutex_unlock(&reload_lock);
 
 	for (con = NULL; (con = ast_walk_contexts(con));)
 		ast_context_verify_includes(con);




More information about the asterisk-commits mailing list