Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv14465

Modified Files:
        ChangeLog asterisk.c dnsmgr.c 
Log Message:
issue #5599


Index: ChangeLog
===================================================================
RCS file: /usr/cvsroot/asterisk/ChangeLog,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- ChangeLog   8 Nov 2005 01:05:52 -0000       1.53
+++ ChangeLog   8 Nov 2005 01:29:14 -0000       1.54
@@ -1,5 +1,8 @@
 2005-11-07  Kevin P. Fleming  <[EMAIL PROTECTED]>
 
+       * asterisk.c (main): force a dnsmgr background refresh after all other 
modules are initialized (issue #5599)
+       * dnsmgr.c: add ability to start a background refresh on demand (issue 
#5599)
+
        * apps/app_dial.c (HANDLE_CAUSE): set CDR disposition to match cause 
code (issue #5602)
 
        * asterisk.c: support 'runuser' and 'rungroup' options in asterisk.conf 
(issue #5621)

Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- asterisk.c  8 Nov 2005 00:30:29 -0000       1.191
+++ asterisk.c  8 Nov 2005 01:29:14 -0000       1.192
@@ -2255,6 +2255,9 @@
                printf(term_quit());
                exit(1);
        }
+
+       dnsmgr_start_refresh();
+
 #if 0
        /* This should no longer be necessary */
        /* sync cust config and reload some internals in case a custom config 
handler binded to them */

Index: dnsmgr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/dnsmgr.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- dnsmgr.c    26 Oct 2005 18:54:24 -0000      1.10
+++ dnsmgr.c    8 Nov 2005 01:29:14 -0000       1.11
@@ -187,8 +187,16 @@
 
        ast_mutex_unlock(&refresh_lock);
 
-       /* automatically reschedule */
-       return -1;
+       /* automatically reschedule based on the interval */
+       return refresh_interval * 1000;
+}
+
+void dnsmgr_start_refresh(void)
+{
+       if (refresh_sched > -1) {
+               ast_sched_del(sched, refresh_sched);
+               refresh_sched = ast_sched_add(sched, 100, refresh_list, 
&master_refresh_info);
+       }
 }
 
 static int do_reload(int loading);
@@ -328,10 +336,8 @@
                ast_config_destroy(config);
        }
 
-       if (enabled && refresh_interval) {
-               refresh_sched = ast_sched_add(sched, refresh_interval * 1000, 
refresh_list, &master_refresh_info);
+       if (enabled && refresh_interval)
                ast_log(LOG_NOTICE, "Managed DNS entries will be refreshed 
every %d seconds.\n", refresh_interval);
-       }
 
        /* if this reload enabled the manager, create the background thread
           if it does not exist */
@@ -340,10 +346,11 @@
                pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
                if (ast_pthread_create(&refresh_thread, &attr, do_refresh, 
NULL) < 0) {
                        ast_log(LOG_ERROR, "Unable to start refresh thread.\n");
-                       ast_sched_del(sched, refresh_sched);
                }
                else {
                        ast_cli_register(&cli_refresh);
+                       /* make a background refresh happen right away */
+                       refresh_sched = ast_sched_add(sched, 100, refresh_list, 
&master_refresh_info);
                        res = 0;
                }
        }

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to