diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2008-09-12 23:30:03 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2008-09-12 23:30:03 +0000 |
commit | 08af5bb31222c39739b8ec216b403756fb250924 (patch) | |
tree | 790035cc6aca2440080bd357a68a09fdbbb2624c /apps/app_queue.c | |
parent | 5d39c767c12477610cf13f5c2e00e7eed7839352 (diff) |
Create a new config file status, CONFIG_STATUS_FILEINVALID for differentiating
when a file is invalid from when a file is missing. This is most important when
we have two configuration files. Consider the following example:
Old system:
sip.conf users.conf Old result New result
======== ========== ========== ==========
Missing Missing SIP doesn't load SIP doesn't load
Missing OK SIP doesn't load SIP doesn't load
Missing Invalid SIP doesn't load SIP doesn't load
OK Missing SIP loads SIP loads
OK OK SIP loads SIP loads
OK Invalid SIP loads incompletely SIP doesn't load
Invalid Missing SIP doesn't load SIP doesn't load
Invalid OK SIP doesn't load SIP doesn't load
Invalid Invalid SIP doesn't load SIP doesn't load
So in the case when users.conf doesn't load because there's a typo that
disrupts the syntax, we may only partially load users, instead of failing with
an error, which may cause some calls not to get processed. Worse yet, the old
system would do this with no indication that anything was even wrong.
(closes issue #10690)
Reported by: dtyoo
Patches:
20080716__bug10690.diff.txt uploaded by Corydon76 (license 14)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@142992 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r-- | apps/app_queue.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index 3f9c9c625..4f6d160ea 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -5135,6 +5135,9 @@ static int reload_queue_rules(int reload) } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { ast_log(LOG_NOTICE, "queuerules.conf has not changed since it was last loaded. Not taking any action.\n"); return AST_MODULE_LOAD_SUCCESS; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file queuerules.conf is in an invalid format. Aborting.\n"); + return AST_MODULE_LOAD_SUCCESS; } else { AST_LIST_LOCK(&rule_lists); while ((rl_iter = AST_LIST_REMOVE_HEAD(&rule_lists, list))) { @@ -5196,8 +5199,12 @@ static int reload_queues(int reload) if (!(cfg = ast_config_load("queues.conf", config_flags))) { ast_log(LOG_NOTICE, "No call queueing config file (queues.conf), so no call queues\n"); return 0; - } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) + } else if (cfg == CONFIG_STATUS_FILEUNCHANGED) { + return 0; + } else if (cfg == CONFIG_STATUS_FILEINVALID) { + ast_log(LOG_ERROR, "Config file queues.conf is in an invalid format. Aborting.\n"); return 0; + } ao2_lock(queues); use_weight=0; /* Mark all queues as dead for the moment */ |