aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_osplookup.c
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 /apps/app_osplookup.c
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 'apps/app_osplookup.c')
-rw-r--r--apps/app_osplookup.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c
index 3e7f9b2b3..25b3fb518 100644
--- a/apps/app_osplookup.c
+++ b/apps/app_osplookup.c
@@ -1773,15 +1773,22 @@ static int ospfinished_exec(
/* OSP Module APIs */
-static int osp_load(void)
+static int osp_unload(void);
+static int osp_load(int reload)
{
const char* t;
unsigned int v;
struct ast_config* cfg;
+ struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
int error = OSPC_ERR_NO_ERROR;
- cfg = ast_config_load(OSP_CONFIG_FILE);
+ if ((cfg = ast_config_load(OSP_CONFIG_FILE, config_flags)) == CONFIG_STATUS_FILEUNCHANGED)
+ return 0;
+
if (cfg) {
+ if (reload)
+ osp_unload();
+
t = ast_variable_retrieve(cfg, OSP_GENERAL_CAT, "accelerate");
if (t && ast_true(t)) {
if ((error = OSPPInit(1)) != OSPC_ERR_NO_ERROR) {
@@ -2000,7 +2007,7 @@ static int load_module(void)
{
int res;
- if(!osp_load())
+ if (!osp_load(0))
return AST_MODULE_LOAD_DECLINE;
ast_cli_register_multiple(cli_osp, sizeof(cli_osp) / sizeof(struct ast_cli_entry));
@@ -2028,8 +2035,7 @@ static int unload_module(void)
static int reload(void)
{
- osp_unload();
- osp_load();
+ osp_load(1);
return 0;
}