diff options
author | David M. Lee <dlee@digium.com> | 2013-05-10 17:12:57 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-05-10 17:12:57 +0000 |
commit | 4666079b05ea3b189e4fdccc665f7a61bf3e5535 (patch) | |
tree | 826e54b6a78671d7e911cbff4799b31b0aed9a30 /rest-api-templates | |
parent | db925c3f066fc73849af06bcfc966467af349891 (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 'rest-api-templates')
-rw-r--r-- | rest-api-templates/res_stasis_http_resource.c.mustache | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rest-api-templates/res_stasis_http_resource.c.mustache b/rest-api-templates/res_stasis_http_resource.c.mustache index 9b1324c09..a9428c060 100644 --- a/rest-api-templates/res_stasis_http_resource.c.mustache +++ b/rest-api-templates/res_stasis_http_resource.c.mustache @@ -38,6 +38,7 @@ /*** MODULEINFO <depend type="module">res_stasis_http</depend> + <depend type="module">res_stasis</depend> <support_level>core</support_level> ***/ @@ -46,6 +47,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/module.h" +#include "asterisk/stasis_app.h" #include "stasis_http/resource_{{name}}.h" {{#has_events}} #include "asterisk/stasis_channels.h" @@ -184,12 +186,14 @@ static void stasis_http_{{c_nickname}}_cb( {{/has_events}} static int load_module(void) { + stasis_app_ref(); return stasis_http_add_handler(&{{root_full_name}}); } static int unload_module(void) { stasis_http_remove_handler(&{{root_full_name}}); + stasis_app_unref(); return 0; } @@ -197,6 +201,6 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "RESTful API module - {{{description}}}", .load = load_module, .unload = unload_module, - .nonoptreq = "res_stasis_http", + .nonoptreq = "res_stasis_http,res_stasis", ); {{/api_declaration}} |