[asterisk-commits] kpfleming: trunk r40796 - in /trunk: include/ main/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Aug 21 15:23:26 MST 2006


Author: kpfleming
Date: Mon Aug 21 17:23:26 2006
New Revision: 40796

URL: http://svn.digium.com/view/asterisk?rev=40796&view=rev
Log:
restore 'preload' functionality in loader

Modified:
    trunk/include/asterisk.h
    trunk/main/asterisk.c
    trunk/main/loader.c

Modified: trunk/include/asterisk.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk.h?rev=40796&r1=40795&r2=40796&view=diff
==============================================================================
--- trunk/include/asterisk.h (original)
+++ trunk/include/asterisk.h Mon Aug 21 17:23:26 2006
@@ -51,7 +51,7 @@
 extern char ast_config_AST_SYSTEM_NAME[20];
 
 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 init_logger(void);				/*!< Provided by logger.c */
 void close_logger(void);			/*!< Provided by logger.c */

Modified: trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/trunk/main/asterisk.c?rev=40796&r1=40795&r2=40796&view=diff
==============================================================================
--- trunk/main/asterisk.c (original)
+++ trunk/main/asterisk.c Mon Aug 21 17:23:26 2006
@@ -2615,7 +2615,7 @@
 		printf(term_quit());
 		exit(1);
 	}
-	if (load_modules()) {
+	if (load_modules(1)) {
 		printf(term_quit());
 		exit(1);
 	}
@@ -2674,6 +2674,11 @@
 	}
 
 	if (ast_enum_init()) {
+		printf(term_quit());
+		exit(1);
+	}
+
+	if (load_modules(0)) {
 		printf(term_quit());
 		exit(1);
 	}

Modified: trunk/main/loader.c
URL: http://svn.digium.com/view/asterisk/trunk/main/loader.c?rev=40796&r1=40795&r2=40796&view=diff
==============================================================================
--- trunk/main/loader.c (original)
+++ trunk/main/loader.c Mon Aug 21 17:23:26 2006
@@ -667,7 +667,7 @@
 	return order;
 }
 
-int load_modules(void)
+int load_modules(unsigned int preload_only)
 {
 	struct ast_config *cfg;
 	struct ast_module *mod;
@@ -699,14 +699,22 @@
 
 	AST_LIST_HEAD_INIT_NOLOCK(&load_order);
 
-	/* 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);
+	if (preload_only) {
+		/* 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, "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 */
-	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 */
 		AST_LIST_TRAVERSE(&module_list, mod, entry) {
 			order = add_to_load_order(mod->resource, &load_order);



More information about the asterisk-commits mailing list