mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
loader.c: Allow dependent modules to be unloaded recursively.
Because of the (often recursive) nature of module dependencies in Asterisk, hot swapping a module on the fly is cumbersome if a module is depended on by other modules. Currently, dependencies must be popped manually by unloading dependents, unloading the module of interest, and then loading modules again in reverse order. To make this easier, the ability to do this recursively in certain circumstances has been added, as an optional extension to the "module refresh" command. If requested, Asterisk will check if a module that has a positive usecount could be unloaded safely if anything recursively dependent on it were unloaded. If so, it will go ahead and unload all these modules and load them back again. This makes hot swapping modules that provide dependencies much easier. Resolves: #474 UserNote: In certain circumstances, modules with dependency relations can have their dependents automatically recursively unloaded and loaded again using the "module refresh" CLI command or the ModuleLoad AMI command.
This commit is contained in:
@@ -149,6 +149,20 @@ enum ast_module_helper_type {
|
||||
*/
|
||||
enum ast_module_load_result ast_load_resource(const char *resource_name);
|
||||
|
||||
/*!
|
||||
* \brief Unload and load a module again.
|
||||
* \param resource_name The name of the module to unload.
|
||||
* \param ast_module_unload_mode The force flag. This should be set using one of the AST_FORCE flags.
|
||||
* \param recursive Attempt to recursively unload any dependents of this module
|
||||
* if that will allow the module to unload, and load them back again afterwards.
|
||||
*
|
||||
*
|
||||
* \retval 0 on success.
|
||||
* \retval 1 on error unloading modules.
|
||||
* \retval -1 on error loading modules back.
|
||||
*/
|
||||
int ast_refresh_resource(const char *resource_name, enum ast_module_unload_mode force, int recursive);
|
||||
|
||||
/*!
|
||||
* \brief Unload a module.
|
||||
* \param resource_name The name of the module to unload.
|
||||
|
Reference in New Issue
Block a user