mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
restore 'preload' functionality in loader
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@40796 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -51,7 +51,7 @@ extern char ast_config_AST_CTL[PATH_MAX];
|
|||||||
extern char ast_config_AST_SYSTEM_NAME[20];
|
extern char ast_config_AST_SYSTEM_NAME[20];
|
||||||
|
|
||||||
int ast_set_priority(int); /*!< Provided by asterisk.c */
|
int ast_set_priority(int); /*!< Provided by asterisk.c */
|
||||||
int load_modules(void); /*!< Provided by loader.c */
|
int load_modules(unsigned int); /*!< Provided by loader.c */
|
||||||
int load_pbx(void); /*!< Provided by pbx.c */
|
int load_pbx(void); /*!< Provided by pbx.c */
|
||||||
int init_logger(void); /*!< Provided by logger.c */
|
int init_logger(void); /*!< Provided by logger.c */
|
||||||
void close_logger(void); /*!< Provided by logger.c */
|
void close_logger(void); /*!< Provided by logger.c */
|
||||||
|
@@ -2615,7 +2615,7 @@ int main(int argc, char *argv[])
|
|||||||
printf(term_quit());
|
printf(term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if (load_modules()) {
|
if (load_modules(1)) {
|
||||||
printf(term_quit());
|
printf(term_quit());
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -2678,6 +2678,11 @@ int main(int argc, char *argv[])
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (load_modules(0)) {
|
||||||
|
printf(term_quit());
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
dnsmgr_start_refresh();
|
dnsmgr_start_refresh();
|
||||||
|
|
||||||
/* We might have the option of showing a console, but for now just
|
/* We might have the option of showing a console, but for now just
|
||||||
|
@@ -667,7 +667,7 @@ static struct load_order_entry *add_to_load_order(const char *resource, struct l
|
|||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
int load_modules(void)
|
int load_modules(unsigned int preload_only)
|
||||||
{
|
{
|
||||||
struct ast_config *cfg;
|
struct ast_config *cfg;
|
||||||
struct ast_module *mod;
|
struct ast_module *mod;
|
||||||
@@ -699,14 +699,22 @@ int load_modules(void)
|
|||||||
|
|
||||||
AST_LIST_HEAD_INIT_NOLOCK(&load_order);
|
AST_LIST_HEAD_INIT_NOLOCK(&load_order);
|
||||||
|
|
||||||
/* first, find all the modules we have been explicitly requested to load */
|
if (preload_only) {
|
||||||
for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
|
/* first, find all the modules we have been explicitly requested to load */
|
||||||
if (!strcasecmp(v->name, "load"))
|
for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
|
||||||
add_to_load_order(v->value, &load_order);
|
if (!strcasecmp(v->name, "preload"))
|
||||||
|
add_to_load_order(v->value, &load_order);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* first, find all the modules we have been explicitly requested to load */
|
||||||
|
for (v = ast_variable_browse(cfg, "modules"); v; v = v->next) {
|
||||||
|
if (!strcasecmp(v->name, "load"))
|
||||||
|
add_to_load_order(v->value, &load_order);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if 'autoload' is on */
|
/* check if 'autoload' is on */
|
||||||
if (ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) {
|
if (!preload_only && ast_true(ast_variable_retrieve(cfg, "modules", "autoload"))) {
|
||||||
/* if so, first add all the embedded modules to the load order */
|
/* if so, first add all the embedded modules to the load order */
|
||||||
AST_LIST_TRAVERSE(&module_list, mod, entry) {
|
AST_LIST_TRAVERSE(&module_list, mod, entry) {
|
||||||
order = add_to_load_order(mod->resource, &load_order);
|
order = add_to_load_order(mod->resource, &load_order);
|
||||||
|
Reference in New Issue
Block a user