aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_indications.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-16 21:09:46 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-16 21:09:46 +0000
commitdbec3d56c146801fad339a1d46a388865b18ffb4 (patch)
tree8fda811f62cb6ffb99847befb7b74b1519ea95ba /res/res_indications.c
parent0fb9c73a989207650aa3ba603824e4593809611b (diff)
Don't reload a configuration file if nothing has changed.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@79747 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_indications.c')
-rw-r--r--res/res_indications.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/res/res_indications.c b/res/res_indications.c
index 2a4f38a3a..e12b6f9a1 100644
--- a/res/res_indications.c
+++ b/res/res_indications.c
@@ -236,7 +236,7 @@ static int handle_stopplaytones(struct ast_channel *chan, void *data)
}
/*! \brief load indications module */
-static int ind_load_module(void)
+static int ind_load_module(int reload)
{
struct ast_config *cfg;
struct ast_variable *v;
@@ -244,12 +244,18 @@ static int ind_load_module(void)
char *c;
struct ind_tone_zone *tones;
const char *country = NULL;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
/* that the following cast is needed, is yuk! */
/* yup, checked it out. It is NOT written to. */
- cfg = ast_config_load((char *)config);
+ cfg = ast_config_load((char *)config, config_flags);
if (!cfg)
return -1;
+ else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
+
+ if (reload)
+ ast_unregister_indication_country(NULL);
/* Use existing config to populate the Indication table */
cxt = ast_category_browse(cfg, NULL);
@@ -385,7 +391,7 @@ static int unload_module(void)
/*! \brief Load indications module */
static int load_module(void)
{
- if (ind_load_module())
+ if (ind_load_module(0))
return AST_MODULE_LOAD_DECLINE;
ast_cli_register_multiple(cli_indications, sizeof(cli_indications) / sizeof(struct ast_cli_entry));
ast_register_application("PlayTones", handle_playtones, "Play a tone list", playtones_desc);
@@ -397,10 +403,7 @@ static int load_module(void)
/*! \brief Reload indications module */
static int reload(void)
{
- /* remove the registed indications... */
- ast_unregister_indication_country(NULL);
-
- return ind_load_module();
+ return ind_load_module(1);
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "Region-specific tones",