aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_smdi.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-07 17:14:40 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-06-07 17:14:40 +0000
commit3703d2ca4c790e77e4526bd9cdc75345deee2bd3 (patch)
tree5d358e8107834a0240a01606d0aa98126c62b9b8 /res/res_smdi.c
parent29da4cbcf642df578dd129a96a1343aff926f9cb (diff)
Avoid unloading res_smdi twice.
(closes issue #17237) Reported by: pabelanger git-svn-id: http://svn.digium.com/svn/asterisk/trunk@268653 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_smdi.c')
-rw-r--r--res/res_smdi.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/res/res_smdi.c b/res/res_smdi.c
index fcd715515..fe99cc9ea 100644
--- a/res/res_smdi.c
+++ b/res/res_smdi.c
@@ -152,6 +152,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
***/
static const char config_file[] = "smdi.conf";
+static int smdi_loaded;
/*! \brief SMDI message desk message queue. */
struct ast_smdi_md_queue {
@@ -1394,6 +1395,7 @@ static int _unload_module(int fromload);
static int load_module(void)
{
int res;
+ smdi_loaded = 1;
/* initialize our containers */
memset(&smdi_ifaces, 0, sizeof(smdi_ifaces));
@@ -1421,6 +1423,10 @@ static int load_module(void)
static int _unload_module(int fromload)
{
+ if (!smdi_loaded) {
+ return 0;
+ }
+
/* this destructor stops any running smdi_read threads */
ASTOBJ_CONTAINER_DESTROYALL(&smdi_ifaces, ast_smdi_interface_destroy);
ASTOBJ_CONTAINER_DESTROY(&smdi_ifaces);
@@ -1441,6 +1447,7 @@ static int _unload_module(int fromload)
ast_custom_function_unregister(&smdi_msg_function);
}
+ smdi_loaded = 0;
return 0;
}