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_manager.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_manager.c')
-rw-r--r-- | cdr/cdr_manager.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/cdr/cdr_manager.c b/cdr/cdr_manager.c index 5dc4da6fe..028b4a8c9 100644 --- a/cdr/cdr_manager.c +++ b/cdr/cdr_manager.c @@ -52,15 +52,22 @@ static char *name = "cdr_manager"; static int enablecdr = 0; struct ast_str *customfields; -static int load_config(void) +static int load_config(int reload) { char *cat = NULL; struct ast_config *cfg; struct ast_variable *v; - + struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 }; + + cfg = ast_config_load(CONF_FILE, config_flags); + if (cfg == CONFIG_STATUS_FILEUNCHANGED) + return 0; + + if (reload && customfields) { + ast_free(customfields); + } customfields = NULL; - cfg = ast_config_load(CONF_FILE); if (!cfg) { /* Standard configuration */ ast_log(LOG_WARNING, "Failed to load configuration file. Module not activated.\n"); @@ -174,7 +181,7 @@ static int load_module(void) int res; /* Configuration file */ - if (!load_config()) + if (!load_config(0)) return AST_MODULE_LOAD_DECLINE; res = ast_cdr_register(name, "Asterisk Manager Interface CDR Backend", manager_log); @@ -187,12 +194,7 @@ static int load_module(void) static int reload(void) { - if (customfields) { - ast_free(customfields); - } - - load_config(); - return 0; + return load_config(1); } AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Manager Interface CDR Backend", |