diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-08-16 21:09:46 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-08-16 21:09:46 +0000 |
commit | 56b9568164b694a42e88f1f8a31012078b833203 (patch) | |
tree | 8fda811f62cb6ffb99847befb7b74b1519ea95ba /cdr/cdr_sqlite3_custom.c | |
parent | c0060cd99a0a318b504da4c13eee85f3b9043fdc (diff) |
Don't reload a configuration file if nothing has changed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'cdr/cdr_sqlite3_custom.c')
-rw-r--r-- | cdr/cdr_sqlite3_custom.c | 20 |
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", |