diff options
author | Joshua Colp <jcolp@digium.com> | 2017-11-06 10:11:51 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-11-06 10:11:51 -0600 |
commit | 68b6ebd83614a5cfacc43191f785a82a4239a9e6 (patch) | |
tree | 46f822ceda11aa9931cc5172e911faa72e1c3141 | |
parent | ac7ec5026c11ca598d6de1ce5ce004c3ffe1c96c (diff) | |
parent | 79f111e1f317fffd3222b70c31a0fac65c40234e (diff) |
Merge "Prevent unload of modules which implement an Optional API."
-rw-r--r-- | funcs/func_periodic_hook.c | 5 | ||||
-rw-r--r-- | res/res_agi.c | 4 | ||||
-rw-r--r-- | res/res_http_websocket.c | 3 | ||||
-rw-r--r-- | res/res_monitor.c | 3 | ||||
-rw-r--r-- | res/res_pktccops.c | 4 | ||||
-rw-r--r-- | res/res_smdi.c | 4 | ||||
-rw-r--r-- | res/res_statsd.c | 3 |
7 files changed, 26 insertions, 0 deletions
diff --git a/funcs/func_periodic_hook.c b/funcs/func_periodic_hook.c index f8e79b326..0ab3d6b8b 100644 --- a/funcs/func_periodic_hook.c +++ b/funcs/func_periodic_hook.c @@ -488,6 +488,11 @@ static int load_module(void) res = ast_custom_function_register_escalating(&hook_function, AST_CFE_BOTH); + if (!res) { + /* For Optional API. */ + ast_module_shutdown_ref(AST_MODULE_SELF); + } + return res ? AST_MODULE_LOAD_DECLINE : AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_agi.c b/res/res_agi.c index 7d2f03afc..13af48f49 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -4714,6 +4714,10 @@ static int load_module(void) unload_module(); return AST_MODULE_LOAD_DECLINE; } + + /* For Optional API. */ + ast_module_shutdown_ref(AST_MODULE_SELF); + return AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c index 60332f591..8e9aae9dd 100644 --- a/res/res_http_websocket.c +++ b/res/res_http_websocket.c @@ -1446,6 +1446,9 @@ static int load_module(void) ast_http_uri_link(&websocketuri); websocket_add_protocol_internal("echo", websocket_echo_callback); + /* For Optional API. */ + ast_module_shutdown_ref(AST_MODULE_SELF); + return 0; } diff --git a/res/res_monitor.c b/res/res_monitor.c index da1982a27..3ac6e455f 100644 --- a/res/res_monitor.c +++ b/res/res_monitor.c @@ -985,6 +985,9 @@ static int load_module(void) ast_manager_register_xml("PauseMonitor", EVENT_FLAG_CALL, pause_monitor_action); ast_manager_register_xml("UnpauseMonitor", EVENT_FLAG_CALL, unpause_monitor_action); + /* For Optional API. */ + ast_module_shutdown_ref(AST_MODULE_SELF); + return AST_MODULE_LOAD_SUCCESS; } diff --git a/res/res_pktccops.c b/res/res_pktccops.c index 4f6944875..e8d266cda 100644 --- a/res/res_pktccops.c +++ b/res/res_pktccops.c @@ -1472,6 +1472,10 @@ static int load_module(void) } ast_cli_register_multiple(cli_pktccops, sizeof(cli_pktccops) / sizeof(struct ast_cli_entry)); restart_pktc_thread(); + + /* For Optional API. */ + ast_module_shutdown_ref(AST_MODULE_SELF); + return 0; } diff --git a/res/res_smdi.c b/res/res_smdi.c index 4d7240104..0edabb83c 100644 --- a/res/res_smdi.c +++ b/res/res_smdi.c @@ -1405,6 +1405,10 @@ static int _unload_module(int fromload) } smdi_loaded = 0; + + /* For Optional API. */ + ast_module_shutdown_ref(AST_MODULE_SELF); + return 0; } diff --git a/res/res_statsd.c b/res/res_statsd.c index 3d7dd1684..aee0bcd5a 100644 --- a/res/res_statsd.c +++ b/res/res_statsd.c @@ -353,6 +353,9 @@ static int load_module(void) return AST_MODULE_LOAD_DECLINE; } + /* For Optional API. */ + ast_module_shutdown_ref(AST_MODULE_SELF); + return AST_MODULE_LOAD_SUCCESS; } |