aboutsummaryrefslogtreecommitdiffstats
path: root/cdr/cdr_sqlite3_custom.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 /cdr/cdr_sqlite3_custom.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 'cdr/cdr_sqlite3_custom.c')
-rw-r--r--cdr/cdr_sqlite3_custom.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/cdr/cdr_sqlite3_custom.c b/cdr/cdr_sqlite3_custom.c
index c3dcbd269..1c663362b 100644
--- a/cdr/cdr_sqlite3_custom.c
+++ b/cdr/cdr_sqlite3_custom.c
@@ -74,10 +74,11 @@ static char values[1024];
static int load_config(int reload)
{
struct ast_config *cfg;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
struct ast_variable *mappingvar;
const char *tmp;
- if (!(cfg = ast_config_load(config_file))) {
+ if (!(cfg = ast_config_load(config_file, config_flags))) {
if (reload)
ast_log(LOG_WARNING, "%s: Failed to reload configuration file.\n", name);
else {
@@ -86,10 +87,10 @@ static int load_config(int reload)
name);
}
return -1;
- }
+ } else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
- if (!reload)
- ast_mutex_lock(&lock);
+ ast_mutex_lock(&lock);
if (!(mappingvar = ast_variable_browse(cfg, "master"))) {
/* nothing configured */
@@ -125,8 +126,7 @@ static int load_config(int reload)
return -1;
}
- if (!reload)
- ast_mutex_unlock(&lock);
+ ast_mutex_unlock(&lock);
ast_config_destroy(cfg);
@@ -248,13 +248,7 @@ static int load_module(void)
static int reload(void)
{
- int res;
-
- ast_mutex_lock(&lock);
- res = load_config(1);
- ast_mutex_unlock(&lock);
-
- return res;
+ return load_config(1);
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "SQLite3 Custom CDR Module",