[svn-commits] file: branch 1.2 r45030 - /branches/1.2/dnsmgr.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Fri Oct 13 08:49:53 MST 2006


Author: file
Date: Fri Oct 13 10:49:53 2006
New Revision: 45030

URL: http://svn.digium.com/view/asterisk?rev=45030&view=rev
Log:
Pass the right value to usleep for sleeping, and always add the background refresh item back into the scheduler if enabled since it is deleted during reload. (issue #8142 reported by p_lindheimer)

Modified:
    branches/1.2/dnsmgr.c

Modified: branches/1.2/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/dnsmgr.c?rev=45030&r1=45029&r2=45030&view=diff
==============================================================================
--- branches/1.2/dnsmgr.c (original)
+++ branches/1.2/dnsmgr.c Fri Oct 13 10:49:53 2006
@@ -147,7 +147,7 @@
 {
 	for (;;) {
 		pthread_testcancel();
-		usleep(ast_sched_wait(sched));
+		usleep((ast_sched_wait(sched)*1000));
 		pthread_testcancel();
 		ast_sched_runq(sched);
 	}
@@ -339,16 +339,16 @@
 
 	/* if this reload enabled the manager, create the background thread
 	   if it does not exist */
-	if (enabled && !was_enabled && (refresh_thread == AST_PTHREADT_NULL)) {
-		if (ast_pthread_create(&refresh_thread, NULL, do_refresh, NULL) < 0) {
-			ast_log(LOG_ERROR, "Unable to start refresh thread.\n");
+	if (enabled) {
+		if (!was_enabled && (refresh_thread == AST_PTHREADT_NULL)) {
+			if (ast_pthread_create(&refresh_thread, NULL, do_refresh, NULL) < 0) {
+				ast_log(LOG_ERROR, "Unable to start refresh thread.\n");
+			}
+			ast_cli_register(&cli_refresh);
 		}
-		else {
-			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);
-			res = 0;
-		}
+		/* make a background refresh happen right away */
+		refresh_sched = ast_sched_add_variable(sched, 100, refresh_list, &master_refresh_info, 1);
+		res = 0;
 	}
 	/* if this reload disabled the manager and there is a background thread,
 	   kill it */



More information about the svn-commits mailing list