[asterisk-commits] tilghman: trunk r268653 - /trunk/res/res_smdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 7 12:14:43 CDT 2010


Author: tilghman
Date: Mon Jun  7 12:14:40 2010
New Revision: 268653

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=268653
Log:
Avoid unloading res_smdi twice.

Modified:
    trunk/res/res_smdi.c

Modified: trunk/res/res_smdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_smdi.c?view=diff&rev=268653&r1=268652&r2=268653
==============================================================================
--- trunk/res/res_smdi.c (original)
+++ trunk/res/res_smdi.c Mon Jun  7 12:14:40 2010
@@ -152,6 +152,7 @@
  ***/
 
 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 load_module(void)
 {
 	int res;
+	smdi_loaded = 1;
 
 	/* initialize our containers */
 	memset(&smdi_ifaces, 0, sizeof(smdi_ifaces));
@@ -1421,6 +1423,10 @@
 
 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 @@
 		ast_custom_function_unregister(&smdi_msg_function);
 	}
 
+	smdi_loaded = 0;
 	return 0;
 }
 




More information about the asterisk-commits mailing list