loader: Flag module as declined in all cases where it fails to load.

This has no effect on startup since AST_MODULE_LOAD_FAILURE aborts
startup, but it's possible for this code to be returned on manual load
of a module after startup.

It is an error for a module to not have a load callback but this is not
a fatal system error.  In this case flag the module as declined, return
AST_MODULE_LOAD_FAILURE only if a required module is broken.

Expand doxygen documentation for AST_MODULE_LOAD_*.

Change-Id: I3c030bb917f6e5a0dfd9d91491a4661b348cabf8
This commit is contained in:
Corey Farrell
2018-10-04 19:33:25 -04:00
parent 6fd21a6af6
commit c6ee3cf639
2 changed files with 39 additions and 6 deletions

View File

@@ -1545,7 +1545,9 @@ static enum ast_module_load_result start_resource(struct ast_module *mod)
}
if (!mod->info->load) {
return AST_MODULE_LOAD_FAILURE;
mod->flags.declined = 1;
return mod->flags.required ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_DECLINE;
}
if (module_deps_reference(mod, NULL)) {
@@ -1593,6 +1595,8 @@ static enum ast_module_load_result start_resource(struct ast_module *mod)
}
break;
case AST_MODULE_LOAD_FAILURE:
mod->flags.declined = 1;
break;
case AST_MODULE_LOAD_SKIP: /* modules should never return this value */
case AST_MODULE_LOAD_PRIORITY:
break;