summaryrefslogtreecommitdiff
path: root/main/loader.c
diff options
context:
space:
mode:
Diffstat (limited to 'main/loader.c')
-rw-r--r--main/loader.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/main/loader.c b/main/loader.c
index 36ac3da77..c1dfc839e 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -376,7 +376,9 @@ static void unload_dynamic_module(struct ast_module *mod)
while (!dlclose(lib));
}
-static struct ast_module *load_dynamic_module(const char *resource_in, unsigned int global_symbols_only)
+static enum ast_module_load_result load_resource(const char *resource_name, unsigned int global_symbols_only, struct ast_heap *resource_heap, int required);
+
+static struct ast_module *load_dynamic_module(const char *resource_in, unsigned int global_symbols_only, struct ast_heap *resource_heap)
{
char fn[PATH_MAX] = "";
void *lib = NULL;
@@ -445,11 +447,12 @@ static struct ast_module *load_dynamic_module(const char *resource_in, unsigned
/* Force any required dependencies to load */
char *each, *required_resource = ast_strdupa(mod->info->nonoptreq);
while ((each = strsep(&required_resource, ","))) {
+ struct ast_module *dependency;
each = ast_strip(each);
-
+ dependency = find_resource(each, 0);
/* Is it already loaded? */
- if (!find_resource(each, 0)) {
- load_dynamic_module(each, global_symbols_only);
+ if (!dependency) {
+ load_resource(each, global_symbols_only, resource_heap, 1);
}
}
}
@@ -807,6 +810,10 @@ static enum ast_module_load_result start_resource(struct ast_module *mod)
char tmp[256];
enum ast_module_load_result res;
+ if (mod->flags.running) {
+ return AST_MODULE_LOAD_SUCCESS;
+ }
+
if (!mod->info->load) {
return AST_MODULE_LOAD_FAILURE;
}
@@ -865,7 +872,7 @@ static enum ast_module_load_result load_resource(const char *resource_name, unsi
return AST_MODULE_LOAD_SKIP;
} else {
#ifdef LOADABLE_MODULES
- if (!(mod = load_dynamic_module(resource_name, global_symbols_only))) {
+ if (!(mod = load_dynamic_module(resource_name, global_symbols_only, resource_heap))) {
/* don't generate a warning message during load_modules() */
if (!global_symbols_only) {
ast_log(LOG_WARNING, "Module '%s' could not be loaded.\n", resource_name);