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 /apps/app_osplookup.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 'apps/app_osplookup.c')
-rw-r--r-- | apps/app_osplookup.c | 16 |
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; } |