mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 03:20:57 +00:00
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
This commit is contained in:
@@ -317,16 +317,18 @@ static int amd_exec(struct ast_channel *chan, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void load_config(void)
|
||||
static void load_config(int reload)
|
||||
{
|
||||
struct ast_config *cfg = NULL;
|
||||
char *cat = NULL;
|
||||
struct ast_variable *var = NULL;
|
||||
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
|
||||
|
||||
if (!(cfg = ast_config_load("amd.conf"))) {
|
||||
if (!(cfg = ast_config_load("amd.conf", config_flags))) {
|
||||
ast_log(LOG_ERROR, "Configuration file amd.conf missing.\n");
|
||||
return;
|
||||
}
|
||||
} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
|
||||
return;
|
||||
|
||||
cat = ast_category_browse(cfg, NULL);
|
||||
|
||||
@@ -377,13 +379,13 @@ static int unload_module(void)
|
||||
|
||||
static int load_module(void)
|
||||
{
|
||||
load_config();
|
||||
load_config(0);
|
||||
return ast_register_application(app, amd_exec, synopsis, descrip);
|
||||
}
|
||||
|
||||
static int reload(void)
|
||||
{
|
||||
load_config();
|
||||
load_config(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user