diff options
author | Joshua Colp <jcolp@digium.com> | 2012-02-13 19:56:02 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2012-02-13 19:56:02 +0000 |
commit | be2ac1b3dd511129917147a52f5775bf56ab50df (patch) | |
tree | 40c834b1da05f602194963816998f788b7cca069 /pbx | |
parent | 34c55e8e7c87a92181fca3e0101dc456eef2475b (diff) |
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
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@355011 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'pbx')
-rw-r--r-- | pbx/pbx_config.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index 94b86d489..4aeabe9c2 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -55,6 +55,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,11 +1778,15 @@ static int pbx_load_module(void) { 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(); @@ -1788,6 +1794,8 @@ static int pbx_load_module(void) 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); |