[asterisk-commits] kharwell: branch kharwell/pimp_my_sip r384974 - in /team/kharwell/pimp_my_sip...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Apr 8 12:14:23 CDT 2013
Author: kharwell
Date: Mon Apr 8 12:14:19 2013
New Revision: 384974
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384974
Log:
Don't attempt a websocket protocol removal if res_http_websocket isn't there
This patch sets the protocols container provided by res_http_websocket to NULL
when the module gets unloaded and adds the necessary checks when adding/
removing a websocket protocol. This prevents some FRACKing on an invalid
pointer to the disposed container if a module that uses res_http_websocket is
unloaded after it.
........
Merged revisions 384942 from http://svn.asterisk.org/svn/asterisk/trunk
Modified:
team/kharwell/pimp_my_sip/ (props changed)
team/kharwell/pimp_my_sip/res/res_http_websocket.c
team/kharwell/pimp_my_sip/res/res_stasis_websocket.c
Propchange: team/kharwell/pimp_my_sip/
------------------------------------------------------------------------------
automerge = *
Propchange: team/kharwell/pimp_my_sip/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Apr 8 12:14:19 2013
@@ -1,1 +1,1 @@
-/trunk:1-384917
+/trunk:1-384973
Modified: team/kharwell/pimp_my_sip/res/res_http_websocket.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/res/res_http_websocket.c?view=diff&rev=384974&r1=384973&r2=384974
==============================================================================
--- team/kharwell/pimp_my_sip/res/res_http_websocket.c (original)
+++ team/kharwell/pimp_my_sip/res/res_http_websocket.c Mon Apr 8 12:14:19 2013
@@ -122,6 +122,10 @@
{
struct websocket_protocol *protocol;
+ if (!protocols) {
+ return -1;
+ }
+
ao2_lock(protocols);
/* Ensure a second protocol handler is not registered for the same protocol */
@@ -156,6 +160,10 @@
int AST_OPTIONAL_API_NAME(ast_websocket_remove_protocol)(const char *name, ast_websocket_callback callback)
{
struct websocket_protocol *protocol;
+
+ if (!protocols) {
+ return -1;
+ }
if (!(protocol = ao2_find(protocols, name, OBJ_KEY))) {
return -1;
@@ -670,6 +678,7 @@
ast_websocket_remove_protocol("echo", websocket_echo_callback);
ast_http_uri_unlink(&websocketuri);
ao2_ref(protocols, -1);
+ protocols = NULL;
return 0;
}
Modified: team/kharwell/pimp_my_sip/res/res_stasis_websocket.c
URL: http://svnview.digium.com/svn/asterisk/team/kharwell/pimp_my_sip/res/res_stasis_websocket.c?view=diff&rev=384974&r1=384973&r2=384974
==============================================================================
--- team/kharwell/pimp_my_sip/res/res_stasis_websocket.c (original)
+++ team/kharwell/pimp_my_sip/res/res_stasis_websocket.c Mon Apr 8 12:14:19 2013
@@ -305,7 +305,7 @@
/* ironic */
return AST_MODULE_LOAD_FAILURE;
}
- r |= ast_websocket_add_protocol(ws_protocol, websocket_callback);
+ r |= ast_websocket_add_protocol(ws_protocol, websocket_callback);
return r;
}
@@ -315,12 +315,13 @@
ast_json_unref(oom_json);
oom_json = NULL;
- r |= ast_websocket_remove_protocol(ws_protocol, websocket_callback);
+ r |= ast_websocket_remove_protocol(ws_protocol, websocket_callback);
return r;
}
AST_MODULE_INFO(ASTERISK_GPL_KEY, 0, "Stasis HTTP bindings",
.load = load_module,
.unload = unload_module,
- .nonoptreq = "app_stasis,res_http_websocket"
+ .nonoptreq = "app_stasis,res_http_websocket",
+ .load_pri = AST_MODPRI_APP_DEPEND,
);
More information about the asterisk-commits
mailing list