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:
Tilghman Lesher
2007-08-16 21:09:46 +00:00
parent c0060cd99a
commit 56b9568164
75 changed files with 881 additions and 561 deletions

View File

@@ -485,12 +485,13 @@ int iax_provision_unload(void)
return 0;
}
int iax_provision_reload(void)
int iax_provision_reload(int reload)
{
struct ast_config *cfg;
struct iax_template *cur, *prev, *next;
char *cat;
int found = 0;
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
if (!provinit)
iax_provision_init();
/* Mark all as dead. No need for locking */
@@ -499,8 +500,8 @@ int iax_provision_reload(void)
cur->dead = 1;
cur = cur->next;
}
cfg = ast_config_load("iaxprov.conf");
if (cfg) {
cfg = ast_config_load("iaxprov.conf", config_flags);
if (cfg != NULL && cfg != CONFIG_STATUS_FILEUNCHANGED) {
/* Load as appropriate */
cat = ast_category_browse(cfg, NULL);
while(cat) {
@@ -512,7 +513,9 @@ int iax_provision_reload(void)
cat = ast_category_browse(cfg, cat);
}
ast_config_destroy(cfg);
} else
} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
return 0;
else
ast_log(LOG_NOTICE, "No IAX provisioning configuration found, IAX provisioning disabled.\n");
ast_mutex_lock(&provlock);
/* Drop dead entries while locked */