summaryrefslogtreecommitdiff
path: root/res/res_http_websocket.c
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-12-29 03:57:17 -0500
committerCorey Farrell <git@cfware.com>2018-01-24 13:37:29 -0500
commit527cf5a57033820313356414b971fdf0f4382b21 (patch)
tree44810fb922062b5c2879cad1e9cb49b6d8772a80 /res/res_http_websocket.c
parent7ce34f4e6a8a2bbfc3cfac9a4465eb0f71372205 (diff)
Remove redundant module checks and references.
This removes references that are no longer needed due to automatic references created by module dependencies. In addition this removes most calls to ast_module_check as they were checking modules which are listed as dependencies. Change-Id: I332a6e8383d4c72c8e89d988a184ab8320c4872e
Diffstat (limited to 'res/res_http_websocket.c')
-rw-r--r--res/res_http_websocket.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c
index 86a154787..bcad1c39c 100644
--- a/res/res_http_websocket.c
+++ b/res/res_http_websocket.c
@@ -131,24 +131,18 @@ struct ast_websocket_server {
struct ao2_container *protocols; /*!< Container for registered protocols */
};
-static void websocket_server_internal_dtor(void *obj)
+static void websocket_server_dtor(void *obj)
{
struct ast_websocket_server *server = obj;
ao2_cleanup(server->protocols);
server->protocols = NULL;
}
-static void websocket_server_dtor(void *obj)
-{
- websocket_server_internal_dtor(obj);
- ast_module_unref(ast_module_info->self);
-}
-
-static struct ast_websocket_server *websocket_server_create_impl(void (*dtor)(void *))
+static struct ast_websocket_server *websocket_server_create_impl(void)
{
RAII_VAR(struct ast_websocket_server *, server, NULL, ao2_cleanup);
- server = ao2_alloc(sizeof(*server), dtor);
+ server = ao2_alloc(sizeof(*server), websocket_server_dtor);
if (!server) {
return NULL;
}
@@ -164,13 +158,12 @@ static struct ast_websocket_server *websocket_server_create_impl(void (*dtor)(vo
static struct ast_websocket_server *websocket_server_internal_create(void)
{
- return websocket_server_create_impl(websocket_server_internal_dtor);
+ return websocket_server_create_impl();
}
struct ast_websocket_server *AST_OPTIONAL_API_NAME(ast_websocket_server_create)(void)
{
- ast_module_ref(ast_module_info->self);
- return websocket_server_create_impl(websocket_server_dtor);
+ return websocket_server_create_impl();
}
/*! \brief Destructor function for sessions */
@@ -997,11 +990,7 @@ static int websocket_add_protocol_internal(const char *name, ast_websocket_callb
int AST_OPTIONAL_API_NAME(ast_websocket_add_protocol)(const char *name, ast_websocket_callback callback)
{
- int res = websocket_add_protocol_internal(name, callback);
- if (res == 0) {
- ast_module_ref(ast_module_info->self);
- }
- return res;
+ return websocket_add_protocol_internal(name, callback);
}
int AST_OPTIONAL_API_NAME(ast_websocket_add_protocol2)(struct ast_websocket_protocol *protocol)
@@ -1016,7 +1005,6 @@ int AST_OPTIONAL_API_NAME(ast_websocket_add_protocol2)(struct ast_websocket_prot
return -1;
}
- ast_module_ref(ast_module_info->self);
return 0;
}
@@ -1031,11 +1019,7 @@ static int websocket_remove_protocol_internal(const char *name, ast_websocket_ca
int AST_OPTIONAL_API_NAME(ast_websocket_remove_protocol)(const char *name, ast_websocket_callback callback)
{
- int res = websocket_remove_protocol_internal(name, callback);
- if (res == 0) {
- ast_module_unref(ast_module_info->self);
- }
- return res;
+ return websocket_remove_protocol_internal(name, callback);
}
/*! \brief Parse the given uri into a path and remote address.
@@ -1457,9 +1441,6 @@ 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;
}