[asterisk-commits] mvanbaak: branch 1.4 r130735 - /branches/1.4/main/dnsmgr.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 14 12:10:22 CDT 2008


Author: mvanbaak
Date: Mon Jul 14 12:10:21 2008
New Revision: 130735

URL: http://svn.digium.com/view/asterisk?view=rev&rev=130735
Log:
notify the user that dnsmgr refresh wont work when dnsmgr is not enabled.
Previously this command would automagically appear and disappear.
This was confusing.

(closes issue #12796)
Reported by: chappell
Patches:
      dnsmgr_refresh_3.diff uploaded by chappell (license 8)
Tested by: russell, chappell, mvanbaak

Modified:
    branches/1.4/main/dnsmgr.c

Modified: branches/1.4/main/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/dnsmgr.c?view=diff&rev=130735&r1=130734&r2=130735
==============================================================================
--- branches/1.4/main/dnsmgr.c (original)
+++ branches/1.4/main/dnsmgr.c Mon Jul 14 12:10:21 2008
@@ -275,6 +275,11 @@
 		.verbose = 1,
 	};
 
+	if(!enabled) {
+		ast_cli(fd, "DNS Manager is disabled.\n");
+		return 0;
+	}
+
 	if (argc > 3)
 		return RESULT_SHOWUSAGE;
 
@@ -342,6 +347,7 @@
 	}
 	ast_cli_register(&cli_reload);
 	ast_cli_register(&cli_status);
+	ast_cli_register(&cli_refresh);
 	return do_reload(1);
 }
 
@@ -394,7 +400,6 @@
 			if (ast_pthread_create_background(&refresh_thread, NULL, do_refresh, NULL) < 0) {
 				ast_log(LOG_ERROR, "Unable to start refresh thread.\n");
 			}
-			ast_cli_register(&cli_refresh);
 		}
 		/* make a background refresh happen right away */
 		refresh_sched = ast_sched_add_variable(sched, 100, refresh_list, &master_refresh_info, 1);
@@ -408,7 +413,6 @@
 		pthread_kill(refresh_thread, SIGURG);
 		pthread_join(refresh_thread, NULL);
 		refresh_thread = AST_PTHREADT_NULL;
-		ast_cli_unregister(&cli_refresh);
 		res = 0;
 	}
 	else




More information about the asterisk-commits mailing list