From 13e65190664d4c1ce38bab30d42aa0086b5f4eea Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Tue, 11 Aug 2009 16:03:31 +0000 Subject: [PATCH] Prevent unloading of embedded languages modules (also fixes MODLANG-121) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14491 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/languages/mod_java/modjava.c | 3 ++- src/mod/languages/mod_lua/mod_lua.cpp | 2 +- src/mod/languages/mod_managed/mod_managed.cpp | 2 +- src/mod/languages/mod_perl/mod_perl.c | 2 +- src/mod/languages/mod_python/mod_python.c | 2 +- src/mod/languages/mod_spidermonkey/mod_spidermonkey.c | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/mod/languages/mod_java/modjava.c b/src/mod/languages/mod_java/modjava.c index 90b492004b..4730fa30c5 100644 --- a/src/mod/languages/mod_java/modjava.c +++ b/src/mod/languages/mod_java/modjava.c @@ -261,7 +261,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_java_load) } else switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating memory pool\n"); - return status; + + return status == SWITCH_STATUS_SUCCESS ? SWITCH_STATUS_NOUNLOAD : status; } SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_java_shutdown) diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index 0f9ab16c76..6d4e369457 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -462,7 +462,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lua_load) do_config(); /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_NOUNLOAD; } SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lua_shutdown) diff --git a/src/mod/languages/mod_managed/mod_managed.cpp b/src/mod/languages/mod_managed/mod_managed.cpp index 3ac2aa9dcc..0fab00fe64 100644 --- a/src/mod/languages/mod_managed/mod_managed.cpp +++ b/src/mod/languages/mod_managed/mod_managed.cpp @@ -363,7 +363,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_managed_load) SWITCH_ADD_API(api_interface, "managed", "Run a module as an API function (Execute)", managed_api_function, " []"); SWITCH_ADD_APP(app_interface, "managed", "Run CLI App", "Run an App on a channel", managed_app_function, " []", SAF_NONE); SWITCH_ADD_API(api_interface, "managedreload", "Force [re]load of a file", managedreload_api_function, ""); - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_NOUNLOAD; } #ifdef _MANAGED diff --git a/src/mod/languages/mod_perl/mod_perl.c b/src/mod/languages/mod_perl/mod_perl.c index 0b40abf918..d0a6bbe03c 100644 --- a/src/mod/languages/mod_perl/mod_perl.c +++ b/src/mod/languages/mod_perl/mod_perl.c @@ -493,7 +493,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_perl_load) do_config(); - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_NOUNLOAD; } /* For Emacs: diff --git a/src/mod/languages/mod_python/mod_python.c b/src/mod/languages/mod_python/mod_python.c index 0df273e1e7..de23351e6d 100644 --- a/src/mod/languages/mod_python/mod_python.c +++ b/src/mod/languages/mod_python/mod_python.c @@ -426,7 +426,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_python_load) SAF_SUPPORT_NOMEDIA); /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_NOUNLOAD; } /* diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 76c957778f..f382fb442b 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -3751,7 +3751,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load) curl_global_init(CURL_GLOBAL_ALL); /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; + return SWITCH_STATUS_NOUNLOAD; } SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spidermonkey_shutdown)