Additional updates for parsing dnsmgr.conf
authorPaul Belanger <paul.belanger@polybeacon.com>
Tue, 13 Sep 2011 21:52:59 +0000 (21:52 +0000)
committerPaul Belanger <paul.belanger@polybeacon.com>
Tue, 13 Sep 2011 21:52:59 +0000 (21:52 +0000)
Review: https://reviewboard.asterisk.org/r/1432/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@335719 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/dnsmgr.c

index a62c371..bd3ab78 100644 (file)
@@ -386,11 +386,9 @@ static int do_reload(int loading)
        struct ast_flags config_flags = { loading ? 0 : CONFIG_FLAG_FILEUNCHANGED };
        int interval;
        int was_enabled;
-       int res = 0;
 
-       config = ast_config_load2("dnsmgr.conf", "dnsmgr", config_flags);
-       if (config == CONFIG_STATUS_FILEMISSING || config == CONFIG_STATUS_FILEUNCHANGED || config == CONFIG_STATUS_FILEINVALID) {
-               return res;
+       if ((config = ast_config_load2("dnsmgr.conf", "dnsmgr", config_flags)) == CONFIG_STATUS_FILEUNCHANGED) {
+               return 0;
        }
 
        /* ensure that no refresh cycles run while the reload is in progress */
@@ -401,6 +399,11 @@ static int do_reload(int loading)
        was_enabled = enabled;
        enabled = 0;
 
+       if (config == CONFIG_STATUS_FILEMISSING || config == CONFIG_STATUS_FILEINVALID) {
+               ast_mutex_unlock(&refresh_lock);
+               return 0;
+       }
+
        AST_SCHED_DEL(sched, refresh_sched);
 
        for (v = ast_variable_browse(config, "general"); v; v = v->next) {
@@ -444,5 +447,5 @@ static int do_reload(int loading)
        ast_mutex_unlock(&refresh_lock);
        manager_event(EVENT_FLAG_SYSTEM, "Reload", "Module: DNSmgr\r\nStatus: %s\r/nMessage: DNSmgr reload Requested\r\n", enabled ? "Enabled" : "Disabled");
 
-       return res;
+       return 0;
 }