summaryrefslogtreecommitdiff
path: root/res/res_stasis_http_channels.c
diff options
context:
space:
mode:
authorDavid M. Lee <dlee@digium.com>2013-05-10 17:12:57 +0000
committerDavid M. Lee <dlee@digium.com>2013-05-10 17:12:57 +0000
commit4666079b05ea3b189e4fdccc665f7a61bf3e5535 (patch)
tree826e54b6a78671d7e911cbff4799b31b0aed9a30 /res/res_stasis_http_channels.c
parentdb925c3f066fc73849af06bcfc966467af349891 (diff)
Address unload order issues for res_stasis* modules
I've noticed when doing a graceful shutdown that the res_stasis_http.so module gets unloaded before the modules that use it, which causes some asserts during their unload. While r386928 was a quick hack to get it to not assert and die, this patch increases the use counts on res_stasis.so and res_stasis_http.so properly. It's a bigger change than I expected, hence the review instead of just committing it. Review: https://reviewboard.asterisk.org/r/2489/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@388350 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_stasis_http_channels.c')
-rw-r--r--res/res_stasis_http_channels.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/res/res_stasis_http_channels.c b/res/res_stasis_http_channels.c
index c21bc1073..aa4481903 100644
--- a/res/res_stasis_http_channels.c
+++ b/res/res_stasis_http_channels.c
@@ -33,6 +33,7 @@
/*** MODULEINFO
<depend type="module">res_stasis_http</depend>
+ <depend type="module">res_stasis</depend>
<support_level>core</support_level>
***/
@@ -41,6 +42,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/module.h"
+#include "asterisk/stasis_app.h"
#include "stasis_http/resource_channels.h"
/*!
@@ -487,12 +489,14 @@ static struct stasis_rest_handlers channels = {
static int load_module(void)
{
+ stasis_app_ref();
return stasis_http_add_handler(&channels);
}
static int unload_module(void)
{
stasis_http_remove_handler(&channels);
+ stasis_app_unref();
return 0;
}
@@ -500,5 +504,5 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT,
"RESTful API module - Channel resources",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "res_stasis_http",
+ .nonoptreq = "res_stasis_http,res_stasis",
);