make modules unbind events and un-reserve subclasses on module unload

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8898 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2008-07-03 23:54:35 +00:00
parent ffb2e317bb
commit 2f94f73921
15 changed files with 98 additions and 28 deletions
+12 -2
View File
@@ -38,11 +38,14 @@ SWITCH_BEGIN_EXTERN_C
#include <lualib.h>
#include "mod_lua_extra.h"
SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load);
SWITCH_MODULE_DEFINITION(mod_lua, mod_lua_load, NULL, NULL);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown);
SWITCH_MODULE_DEFINITION(mod_lua, mod_lua_load, mod_lua_shutdown, NULL);
static struct {
switch_memory_pool_t *pool;
char *xml_handler;
switch_event_node_t *node;
} globals;
int luaopen_freeswitch(lua_State * L);
@@ -389,7 +392,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
switch_api_interface_t *api_interface;
switch_application_interface_t *app_interface;
if (switch_event_bind(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL)
if (switch_event_bind_removable(modname, SWITCH_EVENT_MESSAGE_QUERY, SWITCH_EVENT_SUBCLASS_ANY, message_query_handler, NULL, &globals.node)
!= SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
return SWITCH_STATUS_GENERR;
@@ -411,6 +414,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load)
return SWITCH_STATUS_SUCCESS;
}
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown)
{
switch_event_unbind(&globals.node);
return SWITCH_STATUS_SUCCESS;
}
SWITCH_END_EXTERN_C
/* For Emacs:
* Local Variables: