aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
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 /pbx
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 'pbx')
-rw-r--r--pbx/pbx_config.c9
-rw-r--r--pbx/pbx_dundi.c14
2 files changed, 14 insertions, 9 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index a6b4e0171..77862d0c1 100644
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -722,6 +722,7 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
struct ast_variable *v;
int incomplete = 0; /* incomplete config write? */
FILE *output;
+ struct ast_flags config_flags = { 0 };
const char *base, *slash, *file;
@@ -761,7 +762,7 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
}
snprintf(filename, sizeof(filename), "%s%s%s", base, slash, config);
- cfg = ast_config_load("extensions.conf");
+ cfg = ast_config_load("extensions.conf", config_flags);
/* try to lock contexts list */
if (ast_rdlock_contexts()) {
@@ -1329,8 +1330,9 @@ static int pbx_load_config(const char *config_file)
struct ast_variable *v;
const char *cxt;
const char *aft;
+ struct ast_flags config_flags = { 0 };
- cfg = ast_config_load(config_file);
+ cfg = ast_config_load(config_file, config_flags);
if (!cfg)
return 0;
@@ -1501,8 +1503,9 @@ static void pbx_load_users(void)
int hasvoicemail;
int start, finish, x;
struct ast_context *con;
+ struct ast_flags config_flags = { 0 };
- cfg = ast_config_load("users.conf");
+ cfg = ast_config_load("users.conf", config_flags);
if (!cfg)
return;
con = ast_context_find_or_create(&local_contexts, userscontext, registrar);
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index c077f4d5d..7d3fd82c1 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -4555,13 +4555,14 @@ static struct ast_switch dundi_switch =
matchmore: dundi_matchmore,
};
-static int set_config(char *config_file, struct sockaddr_in* sin)
+static int set_config(char *config_file, struct sockaddr_in* sin, int reload)
{
struct ast_config *cfg;
struct ast_variable *v;
char *cat;
int format;
int x;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
char hn[MAXHOSTNAMELEN] = "";
struct ast_hostent he;
struct hostent *hp;
@@ -4570,11 +4571,12 @@ static int set_config(char *config_file, struct sockaddr_in* sin)
int globalpcmodel = 0;
dundi_eid testeid;
+ if ((cfg = ast_config_load(config_file, config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
+
dundi_ttl = DUNDI_DEFAULT_TTL;
dundi_cache_time = DUNDI_DEFAULT_CACHE_TIME;
- cfg = ast_config_load(config_file);
-
-
+
if (!cfg) {
ast_log(LOG_ERROR, "Unable to load config %s\n", config_file);
return -1;
@@ -4741,7 +4743,7 @@ static int reload(void)
{
struct sockaddr_in sin;
- if (set_config("dundi.conf", &sin))
+ if (set_config("dundi.conf", &sin, 1))
return -1;
return 0;
@@ -4765,7 +4767,7 @@ static int load_module(void)
if (!io || !sched)
return AST_MODULE_LOAD_FAILURE;
- if (set_config("dundi.conf", &sin))
+ if (set_config("dundi.conf", &sin, 0))
return AST_MODULE_LOAD_DECLINE;
netsocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);