git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7007 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.2-netsec
Kevin P. Fleming 20 years ago
parent 0ac4bbfdd9
commit 81bda951d2

@ -1,5 +1,8 @@
2005-11-07 Kevin P. Fleming <kpfleming@digium.com> 2005-11-07 Kevin P. Fleming <kpfleming@digium.com>
* 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) * 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) * asterisk.c: support 'runuser' and 'rungroup' options in asterisk.conf (issue #5621)

@ -2255,6 +2255,9 @@ int main(int argc, char *argv[])
printf(term_quit()); printf(term_quit());
exit(1); exit(1);
} }
dnsmgr_start_refresh();
#if 0 #if 0
/* This should no longer be necessary */ /* This should no longer be necessary */
/* sync cust config and reload some internals in case a custom config handler binded to them */ /* sync cust config and reload some internals in case a custom config handler binded to them */

@ -187,8 +187,16 @@ static int refresh_list(void *data)
ast_mutex_unlock(&refresh_lock); ast_mutex_unlock(&refresh_lock);
/* automatically reschedule */ /* automatically reschedule based on the interval */
return -1; 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); static int do_reload(int loading);
@ -328,10 +336,8 @@ static int do_reload(int loading)
ast_config_destroy(config); ast_config_destroy(config);
} }
if (enabled && refresh_interval) { if (enabled && refresh_interval)
refresh_sched = ast_sched_add(sched, refresh_interval * 1000, refresh_list, &master_refresh_info);
ast_log(LOG_NOTICE, "Managed DNS entries will be refreshed every %d seconds.\n", 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 this reload enabled the manager, create the background thread
if it does not exist */ if it does not exist */
@ -340,10 +346,11 @@ static int do_reload(int loading)
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (ast_pthread_create(&refresh_thread, &attr, do_refresh, NULL) < 0) { if (ast_pthread_create(&refresh_thread, &attr, do_refresh, NULL) < 0) {
ast_log(LOG_ERROR, "Unable to start refresh thread.\n"); ast_log(LOG_ERROR, "Unable to start refresh thread.\n");
ast_sched_del(sched, refresh_sched);
} }
else { else {
ast_cli_register(&cli_refresh); 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; res = 0;
} }
} }

@ -42,27 +42,28 @@ extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH]; extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH];
/* Provided by asterisk.c */ /* Provided by asterisk.c */
extern int ast_set_priority(int); int ast_set_priority(int);
/* Provided by module.c */ /* Provided by module.c */
extern int load_modules(const int preload_only); int load_modules(const int preload_only);
/* Provided by pbx.c */ /* Provided by pbx.c */
extern int load_pbx(void); int load_pbx(void);
/* Provided by logger.c */ /* Provided by logger.c */
extern int init_logger(void); int init_logger(void);
extern void close_logger(void); void close_logger(void);
/* Provided by frame.c */ /* Provided by frame.c */
extern int init_framer(void); int init_framer(void);
/* Provided by logger.c */ /* Provided by logger.c */
extern int reload_logger(int); int reload_logger(int);
/* Provided by term.c */ /* Provided by term.c */
extern int term_init(void); int term_init(void);
/* Provided by db.c */ /* Provided by db.c */
extern int astdb_init(void); int astdb_init(void);
/* Provided by channel.c */ /* Provided by channel.c */
extern void ast_channels_init(void); void ast_channels_init(void);
/* Provided by dnsmgr.c */ /* Provided by dnsmgr.c */
extern int dnsmgr_init(void); int dnsmgr_init(void);
extern void dnsmgr_reload(void); void dnsmgr_start_refresh(void);
void dnsmgr_reload(void);
/*! /*!
* \brief Register the version of a source code file with the core. * \brief Register the version of a source code file with the core.

Loading…
Cancel
Save