summaryrefslogtreecommitdiff
path: root/main/http.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2018-02-16 22:11:42 -0500
committerCorey Farrell <git@cfware.com>2018-03-14 05:20:12 -0400
commit572a508ef2ae7cd86e0ffd8ad6d1c5997e988c26 (patch)
treea0dcfa18f8a4a9d3e87eac3b2a7df33ac2fbcad6 /main/http.c
parentfee929c8acd788a77982b537953bf4053242057e (diff)
loader: Convert reload_classes to built-in modules.
* acl (named_acl.c) * cdr * cel * ccss * dnsmgr * dsp * enum * extconfig (config.c) * features * http * indications * logger * manager * plc * sounds * udptl These modules are now loaded at appropriate time by the module loader. Unlike loadable modules these use AST_MODULE_LOAD_FAILURE on error so the module loader will abort startup on failure of these modules. Some of these modules are still initialized or shutdown from outside the module loader. logger.c is initialized very early and shutdown very late, manager.c is initialized by the module loader but is shutdown by the Asterisk core (too much uses it without holding references). Change-Id: I371a9a45064f20026c492623ea8062d02a1ab97f
Diffstat (limited to 'main/http.c')
-rw-r--r--main/http.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/main/http.c b/main/http.c
index 30b2fe2c4..55d10290b 100644
--- a/main/http.c
+++ b/main/http.c
@@ -60,7 +60,7 @@
#include "asterisk/stringfields.h"
#include "asterisk/ast_version.h"
#include "asterisk/manager.h"
-#include "asterisk/_private.h"
+#include "asterisk/module.h"
#include "asterisk/astobj2.h"
#include "asterisk/netsock2.h"
#include "asterisk/json.h"
@@ -2264,7 +2264,7 @@ static char *handle_show_http(struct ast_cli_entry *e, int cmd, struct ast_cli_a
return CLI_SUCCESS;
}
-int ast_http_reload(void)
+static int reload_module(void)
{
return __ast_http_load(1);
}
@@ -2273,7 +2273,7 @@ static struct ast_cli_entry cli_http[] = {
AST_CLI_DEFINE(handle_show_http, "Display HTTP server status"),
};
-static void http_shutdown(void)
+static int unload_module(void)
{
struct http_uri_redirect *redirect;
ast_cli_unregister_multiple(cli_http, ARRAY_LEN(cli_http));
@@ -2295,14 +2295,23 @@ static void http_shutdown(void)
ast_free(redirect);
}
AST_RWLIST_UNLOCK(&uri_redirects);
+
+ return 0;
}
-int ast_http_init(void)
+static int load_module(void)
{
ast_http_uri_link(&statusuri);
ast_http_uri_link(&staticuri);
ast_cli_register_multiple(cli_http, ARRAY_LEN(cli_http));
- ast_register_cleanup(http_shutdown);
- return __ast_http_load(0);
+ return __ast_http_load(0) ? AST_MODULE_LOAD_FAILURE : AST_MODULE_LOAD_SUCCESS;
}
+
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER, "Built-in HTTP Server",
+ .support_level = AST_MODULE_SUPPORT_CORE,
+ .load = load_module,
+ .unload = unload_module,
+ .reload = reload_module,
+ .load_pri = AST_MODPRI_CORE,
+);