From 58477e2410bcd873fce36e9d482f6fa0b5d0ef7e Mon Sep 17 00:00:00 2001 From: Joshua Colp Date: Fri, 13 Oct 2006 15:49:53 +0000 Subject: [PATCH] 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) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@45030 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- dnsmgr.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dnsmgr.c b/dnsmgr.c index de83247417..5838114905 100644 --- a/dnsmgr.c +++ b/dnsmgr.c @@ -147,7 +147,7 @@ static void *do_refresh(void *data) { for (;;) { pthread_testcancel(); - usleep(ast_sched_wait(sched)); + usleep((ast_sched_wait(sched)*1000)); pthread_testcancel(); ast_sched_runq(sched); } @@ -339,16 +339,16 @@ static int do_reload(int loading) /* 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"); - } - else { + 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); - /* 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 */ -- 2.47.2