[Asterisk-cvs] asterisk/channels chan_iax.c,1.42,1.43 chan_iax2.c,1.80,1.81 chan_modem.c,1.17,1.18 chan_nbs.c,1.3,1.4 chan_phone.c,1.21,1.22 chan_vofr.c,1.11,1.12 chan_vpb.c,1.11,1.12 chan_zap.c,1.150,1.151

markster at lists.digium.com markster at lists.digium.com
Tue Dec 9 18:03:48 CST 2003


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv20988/channels

Modified Files:
	chan_iax.c chan_iax2.c chan_modem.c chan_nbs.c chan_phone.c 
	chan_vofr.c chan_vpb.c chan_zap.c 
Log Message:
Cleanup unload calls


Index: chan_iax.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- chan_iax.c	17 Nov 2003 23:46:54 -0000	1.42
+++ chan_iax.c	9 Dec 2003 23:55:17 -0000	1.43
@@ -5330,6 +5330,33 @@
 	matchmore:		iax_matchmore,
 };
 
+static int __unload_module(void)
+{
+	int x;
+	/* Cancel the network thread, close the net socket */
+	pthread_cancel(netthreadid);
+	pthread_join(netthreadid, NULL);
+	close(netsocket);
+	for (x=0;x<AST_IAX_MAX_CALLS;x++)
+		if (iaxs[x])
+			iax_destroy(x);
+	ast_manager_unregister( "IAXpeers" );
+	ast_cli_unregister(&cli_show_users);
+	ast_cli_unregister(&cli_show_channels);
+	ast_cli_unregister(&cli_show_peers);
+	ast_cli_unregister(&cli_set_jitter);
+	ast_cli_unregister(&cli_show_stats);
+	ast_cli_unregister(&cli_show_cache);
+	ast_unregister_switch(&iax_switch);
+	delete_users();
+	return 0;
+}
+
+int unload_module()
+{
+	return __unload_module();
+}
+
 int load_module(void)
 {
 	char *config = "iax.conf";
@@ -5379,7 +5406,7 @@
 
 	if (ast_channel_register(type, tdesc, iax_capability, iax_request)) {
 		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
-		unload_module();
+		__unload_module();
 		return -1;
 	}
 
@@ -5424,28 +5451,6 @@
 char *description()
 {
 	return desc;
-}
-
-int unload_module()
-{
-	int x;
-	/* Cancel the network thread, close the net socket */
-	pthread_cancel(netthreadid);
-	pthread_join(netthreadid, NULL);
-	close(netsocket);
-	for (x=0;x<AST_IAX_MAX_CALLS;x++)
-		if (iaxs[x])
-			iax_destroy(x);
-	ast_manager_unregister( "IAXpeers" );
-	ast_cli_unregister(&cli_show_users);
-	ast_cli_unregister(&cli_show_channels);
-	ast_cli_unregister(&cli_show_peers);
-	ast_cli_unregister(&cli_set_jitter);
-	ast_cli_unregister(&cli_show_stats);
-	ast_cli_unregister(&cli_show_cache);
-	ast_unregister_switch(&iax_switch);
-	delete_users();
-	return 0;
 }
 
 int usecount()

Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- chan_iax2.c	8 Dec 2003 23:42:07 -0000	1.80
+++ chan_iax2.c	9 Dec 2003 23:55:17 -0000	1.81
@@ -5986,6 +5986,33 @@
 	matchmore:		iax2_matchmore,
 };
 
+static int __unload_module(void)
+{
+	int x;
+	/* Cancel the network thread, close the net socket */
+	pthread_cancel(netthreadid);
+	pthread_join(netthreadid, NULL);
+	close(netsocket);
+	for (x=0;x<IAX_MAX_CALLS;x++)
+		if (iaxs[x])
+			iax2_destroy(x);
+	ast_manager_unregister( "IAXpeers" );
+	ast_cli_unregister(&cli_show_users);
+	ast_cli_unregister(&cli_show_channels);
+	ast_cli_unregister(&cli_show_peers);
+	ast_cli_unregister(&cli_set_jitter);
+	ast_cli_unregister(&cli_show_stats);
+	ast_cli_unregister(&cli_show_cache);
+	ast_unregister_switch(&iax2_switch);
+	delete_users();
+	return 0;
+}
+
+int unload_module()
+{
+	return __unload_module();
+}
+
 int load_module(void)
 {
 	char *config = "iax.conf";
@@ -6048,7 +6075,7 @@
 
 	if (ast_channel_register(type, tdesc, iax2_capability, iax2_request)) {
 		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
-		unload_module();
+		__unload_module();
 		return -1;
 	}
 
@@ -6093,28 +6120,6 @@
 char *description()
 {
 	return desc;
-}
-
-int unload_module()
-{
-	int x;
-	/* Cancel the network thread, close the net socket */
-	pthread_cancel(netthreadid);
-	pthread_join(netthreadid, NULL);
-	close(netsocket);
-	for (x=0;x<IAX_MAX_CALLS;x++)
-		if (iaxs[x])
-			iax2_destroy(x);
-	ast_manager_unregister( "IAXpeers" );
-	ast_cli_unregister(&cli_show_users);
-	ast_cli_unregister(&cli_show_channels);
-	ast_cli_unregister(&cli_show_peers);
-	ast_cli_unregister(&cli_set_jitter);
-	ast_cli_unregister(&cli_show_stats);
-	ast_cli_unregister(&cli_show_cache);
-	ast_unregister_switch(&iax2_switch);
-	delete_users();
-	return 0;
 }
 
 int usecount()

Index: chan_modem.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_modem.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- chan_modem.c	8 Sep 2003 16:48:06 -0000	1.17
+++ chan_modem.c	9 Dec 2003 23:55:17 -0000	1.18
@@ -840,6 +840,64 @@
 	return group;
 }
 
+static int __unload_module(void)
+{
+	struct ast_modem_pvt *p, *pl;
+	/* First, take us out of the channel loop */
+	ast_channel_unregister(type);
+	if (!ast_mutex_lock(&iflock)) {
+		/* Hangup all interfaces if they have an owner */
+		p = iflist;
+		while(p) {
+			if (p->owner)
+				ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
+			p = p->next;
+		}
+		iflist = NULL;
+		ast_mutex_unlock(&iflock);
+	} else {
+		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
+		return -1;
+	}
+	if (!ast_mutex_lock(&monlock)) {
+		if (monitor_thread != (pthread_t) -1 && monitor_thread != (pthread_t) -2) {
+			pthread_cancel(monitor_thread);
+			pthread_join(monitor_thread, NULL);
+		}
+		monitor_thread = (pthread_t) -2;
+		ast_mutex_unlock(&monlock);
+	} else {
+		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
+		return -1;
+	}
+
+	if (!ast_mutex_lock(&iflock)) {
+		/* Destroy all the interfaces and free their memory */
+		p = iflist;
+		while(p) {
+			/* Close the socket, assuming it's real */
+			if (p->fd > -1)
+				close(p->fd);
+			pl = p;
+			p = p->next;
+			/* Free associated memory */
+			free(pl);
+		}
+		iflist = NULL;
+		ast_mutex_unlock(&iflock);
+	} else {
+		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
+		return -1;
+	}
+		
+	return 0;
+}
+
+int unload_module()
+{
+	return __unload_module();
+}
+
 int load_module()
 {
 	struct ast_config *cfg;
@@ -871,7 +929,7 @@
 					ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
 					ast_destroy(cfg);
 					ast_mutex_unlock(&iflock);
-					unload_module();
+					__unload_module();
 					return -1;
 				}
 		} else if (!strcasecmp(v->name, "driver")) {
@@ -883,7 +941,7 @@
 				ast_log(LOG_ERROR, "Failed to load driver %s\n", driver);
 				ast_destroy(cfg);
 				ast_mutex_unlock(&iflock);
-				unload_module();
+				__unload_module();
 				return -1;
 			}
 		} else if (!strcasecmp(v->name, "mode")) {
@@ -921,65 +979,12 @@
 						AST_FORMAT_SLINEAR, modem_request)) {
 		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
 		ast_destroy(cfg);
-		unload_module();
+		__unload_module();
 		return -1;
 	}
 	ast_destroy(cfg);
 	/* And start the monitor for the first time */
 	restart_monitor();
-	return 0;
-}
-
-int unload_module()
-{
-	struct ast_modem_pvt *p, *pl;
-	/* First, take us out of the channel loop */
-	ast_channel_unregister(type);
-	if (!ast_mutex_lock(&iflock)) {
-		/* Hangup all interfaces if they have an owner */
-		p = iflist;
-		while(p) {
-			if (p->owner)
-				ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
-			p = p->next;
-		}
-		iflist = NULL;
-		ast_mutex_unlock(&iflock);
-	} else {
-		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
-		return -1;
-	}
-	if (!ast_mutex_lock(&monlock)) {
-		if (monitor_thread != (pthread_t) -1 && monitor_thread != (pthread_t) -2) {
-			pthread_cancel(monitor_thread);
-			pthread_join(monitor_thread, NULL);
-		}
-		monitor_thread = (pthread_t) -2;
-		ast_mutex_unlock(&monlock);
-	} else {
-		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
-		return -1;
-	}
-
-	if (!ast_mutex_lock(&iflock)) {
-		/* Destroy all the interfaces and free their memory */
-		p = iflist;
-		while(p) {
-			/* Close the socket, assuming it's real */
-			if (p->fd > -1)
-				close(p->fd);
-			pl = p;
-			p = p->next;
-			/* Free associated memory */
-			free(pl);
-		}
-		iflist = NULL;
-		ast_mutex_unlock(&iflock);
-	} else {
-		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
-		return -1;
-	}
-		
 	return 0;
 }
 

Index: chan_nbs.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_nbs.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- chan_nbs.c	13 Aug 2003 15:25:16 -0000	1.3
+++ chan_nbs.c	9 Dec 2003 23:55:17 -0000	1.4
@@ -252,24 +252,27 @@
 	return tmp;
 }
 
+static int __unload_module(void)
+{
+	/* First, take us out of the channel loop */
+	ast_channel_unregister(type);
+	return 0;
+}
+
+int unload_module(void)
+{
+	return __unload_module();
+}
+
 int load_module()
 {
 	/* Make sure we can register our Adtranphone channel type */
 	if (ast_channel_register(type, tdesc, 
 			 AST_FORMAT_SLINEAR, nbs_request)) {
 		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
-		unload_module();
+		__unload_module();
 		return -1;
 	}
-	return 0;
-}
-
-
-
-int unload_module()
-{
-	/* First, take us out of the channel loop */
-	ast_channel_unregister(type);
 	return 0;
 }
 

Index: chan_phone.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_phone.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- chan_phone.c	17 Sep 2003 04:39:22 -0000	1.21
+++ chan_phone.c	9 Dec 2003 23:55:17 -0000	1.22
@@ -1051,6 +1051,64 @@
 	return (int)gain;
 }
 
+static int __unload_module(void)
+{
+	struct phone_pvt *p, *pl;
+	/* First, take us out of the channel loop */
+	ast_channel_unregister(type);
+	if (!ast_mutex_lock(&iflock)) {
+		/* Hangup all interfaces if they have an owner */
+		p = iflist;
+		while(p) {
+			if (p->owner)
+				ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
+			p = p->next;
+		}
+		iflist = NULL;
+		ast_mutex_unlock(&iflock);
+	} else {
+		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
+		return -1;
+	}
+	if (!ast_mutex_lock(&monlock)) {
+		if (monitor_thread > -1) {
+			pthread_cancel(monitor_thread);
+			pthread_join(monitor_thread, NULL);
+		}
+		monitor_thread = -2;
+		ast_mutex_unlock(&monlock);
+	} else {
+		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
+		return -1;
+	}
+
+	if (!ast_mutex_lock(&iflock)) {
+		/* Destroy all the interfaces and free their memory */
+		p = iflist;
+		while(p) {
+			/* Close the socket, assuming it's real */
+			if (p->fd > -1)
+				close(p->fd);
+			pl = p;
+			p = p->next;
+			/* Free associated memory */
+			free(pl);
+		}
+		iflist = NULL;
+		ast_mutex_unlock(&iflock);
+	} else {
+		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
+		return -1;
+	}
+		
+	return 0;
+}
+
+int unload_module(void)
+{
+	return __unload_module();
+}
+
 int load_module()
 {
 	struct ast_config *cfg;
@@ -1083,7 +1141,7 @@
 					ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
 					ast_destroy(cfg);
 					ast_mutex_unlock(&iflock);
-					unload_module();
+					__unload_module();
 					return -1;
 				}
 		} else if (!strcasecmp(v->name, "silencesupression")) {
@@ -1136,67 +1194,12 @@
 			 AST_FORMAT_G723_1 | AST_FORMAT_SLINEAR | AST_FORMAT_ULAW, phone_request)) {
 		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
 		ast_destroy(cfg);
-		unload_module();
+		__unload_module();
 		return -1;
 	}
 	ast_destroy(cfg);
 	/* And start the monitor for the first time */
 	restart_monitor();
-	return 0;
-}
-
-
-
-int unload_module()
-{
-	struct phone_pvt *p, *pl;
-	/* First, take us out of the channel loop */
-	ast_channel_unregister(type);
-	if (!ast_mutex_lock(&iflock)) {
-		/* Hangup all interfaces if they have an owner */
-		p = iflist;
-		while(p) {
-			if (p->owner)
-				ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
-			p = p->next;
-		}
-		iflist = NULL;
-		ast_mutex_unlock(&iflock);
-	} else {
-		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
-		return -1;
-	}
-	if (!ast_mutex_lock(&monlock)) {
-		if (monitor_thread > -1) {
-			pthread_cancel(monitor_thread);
-			pthread_join(monitor_thread, NULL);
-		}
-		monitor_thread = -2;
-		ast_mutex_unlock(&monlock);
-	} else {
-		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
-		return -1;
-	}
-
-	if (!ast_mutex_lock(&iflock)) {
-		/* Destroy all the interfaces and free their memory */
-		p = iflist;
-		while(p) {
-			/* Close the socket, assuming it's real */
-			if (p->fd > -1)
-				close(p->fd);
-			pl = p;
-			p = p->next;
-			/* Free associated memory */
-			free(pl);
-		}
-		iflist = NULL;
-		ast_mutex_unlock(&iflock);
-	} else {
-		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
-		return -1;
-	}
-		
 	return 0;
 }
 

Index: chan_vofr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vofr.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- chan_vofr.c	13 Aug 2003 15:25:16 -0000	1.11
+++ chan_vofr.c	9 Dec 2003 23:55:17 -0000	1.12
@@ -1136,61 +1136,7 @@
 	return tmp;
 }
 
-int load_module()
-{
-	struct ast_config *cfg;
-	struct ast_variable *v;
-	struct vofr_pvt *tmp;
-	cfg = ast_load(config);
-
-	/* We *must* have a config file otherwise stop immediately */
-	if (!cfg) {
-		ast_log(LOG_ERROR, "Unable to load config %s\n", config);
-		return -1;
-	}
-	if (ast_mutex_lock(&iflock)) {
-		/* It's a little silly to lock it, but we mind as well just to be sure */
-		ast_log(LOG_ERROR, "Unable to lock interface list???\n");
-		return -1;
-	}
-	v = ast_variable_browse(cfg, "interfaces");
-	while(v) {
-		/* Create the interface list */
-		if (!strcasecmp(v->name, "user") ||
-			!strcasecmp(v->name, "network")) {
-				tmp = mkif(v->name, v->value);
-				if (tmp) {
-					tmp->next = iflist;
-					iflist = tmp;
-				} else {
-					ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
-					ast_destroy(cfg);
-					ast_mutex_unlock(&iflock);
-					unload_module();
-					return -1;
-				}
-		} else if (!strcasecmp(v->name, "context")) {
-			strncpy(context, v->value, sizeof(context)-1);
-		} else if (!strcasecmp(v->name, "language")) {
-			strncpy(language, v->value, sizeof(language)-1);
-		}
-		v = v->next;
-	}
-	ast_mutex_unlock(&iflock);
-	/* Make sure we can register our AdtranVoFR channel type */
-	if (ast_channel_register(type, tdesc, AST_FORMAT_G723_1, vofr_request)) {
-		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
-		ast_destroy(cfg);
-		unload_module();
-		return -1;
-	}
-	ast_destroy(cfg);
-	/* And start the monitor for the first time */
-	restart_monitor();
-	return 0;
-}
-
-int unload_module()
+static int __unload_module(void)
 {
 	struct vofr_pvt *p, *pl;
 	/* First, take us out of the channel loop */
@@ -1241,6 +1187,65 @@
 		return -1;
 	}
 		
+	return 0;
+}
+
+int unload_module()
+{
+	return __unload_module();
+}
+
+int load_module()
+{
+	struct ast_config *cfg;
+	struct ast_variable *v;
+	struct vofr_pvt *tmp;
+	cfg = ast_load(config);
+
+	/* We *must* have a config file otherwise stop immediately */
+	if (!cfg) {
+		ast_log(LOG_ERROR, "Unable to load config %s\n", config);
+		return -1;
+	}
+	if (ast_mutex_lock(&iflock)) {
+		/* It's a little silly to lock it, but we mind as well just to be sure */
+		ast_log(LOG_ERROR, "Unable to lock interface list???\n");
+		return -1;
+	}
+	v = ast_variable_browse(cfg, "interfaces");
+	while(v) {
+		/* Create the interface list */
+		if (!strcasecmp(v->name, "user") ||
+			!strcasecmp(v->name, "network")) {
+				tmp = mkif(v->name, v->value);
+				if (tmp) {
+					tmp->next = iflist;
+					iflist = tmp;
+				} else {
+					ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
+					ast_destroy(cfg);
+					ast_mutex_unlock(&iflock);
+					__unload_module();
+					return -1;
+				}
+		} else if (!strcasecmp(v->name, "context")) {
+			strncpy(context, v->value, sizeof(context)-1);
+		} else if (!strcasecmp(v->name, "language")) {
+			strncpy(language, v->value, sizeof(language)-1);
+		}
+		v = v->next;
+	}
+	ast_mutex_unlock(&iflock);
+	/* Make sure we can register our AdtranVoFR channel type */
+	if (ast_channel_register(type, tdesc, AST_FORMAT_G723_1, vofr_request)) {
+		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
+		ast_destroy(cfg);
+		__unload_module();
+		return -1;
+	}
+	ast_destroy(cfg);
+	/* And start the monitor for the first time */
+	restart_monitor();
 	return 0;
 }
 

Index: chan_vpb.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_vpb.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- chan_vpb.c	18 Nov 2003 15:13:38 -0000	1.11
+++ chan_vpb.c	9 Dec 2003 23:55:17 -0000	1.12
@@ -1112,6 +1112,62 @@
 	return gain;
 }
 
+static int __unload_module(void)
+{
+     struct vpb_pvt *p;
+	/* First, take us out of the channel loop */
+	ast_channel_unregister(type);
+
+	ast_mutex_lock(&iflock); {
+	     /* Hangup all interfaces if they have an owner */
+	     p = iflist;
+	     while(p) {
+		  if (p->owner)
+		       ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
+		  p = p->next;
+	     }
+	     iflist = NULL;
+	} ast_mutex_unlock(&iflock);
+
+	ast_mutex_lock(&monlock); {
+	     if (mthreadactive > -1) {
+		  pthread_cancel(monitor_thread);
+		  pthread_join(monitor_thread, NULL);
+	     }
+	     mthreadactive = -2;
+	} ast_mutex_unlock(&monlock);
+
+	ast_mutex_lock(&iflock); {
+		/* Destroy all the interfaces and free their memory */
+
+		while(iflist) {
+		     p = iflist;		    
+		     ast_mutex_destroy(&p->lock);
+		     pthread_cancel(p->readthread);
+		     p->readthread = 0;
+		     
+		     iflist = iflist->next;
+		     
+		     free(p);
+		}
+		iflist = NULL;
+	} ast_mutex_unlock(&iflock);
+	
+	ast_mutex_lock(&bridge_lock); {
+	     memset(bridges, 0, sizeof bridges);	     
+	} ast_mutex_unlock(&bridge_lock);
+	ast_mutex_destroy(&bridge_lock);
+
+	tcounter = 0;
+	
+	return 0;
+}
+
+int unload_module(void)
+{
+	return __unload_module();
+}
+
 int load_module()
 {
 	struct ast_config *cfg;
@@ -1213,63 +1269,11 @@
 
 
 	if (error)
-	     unload_module();
+	     __unload_module();
 	else	     
 	     restart_monitor(); /* And start the monitor for the first time */
 	
 	return error;
-}
-
-
-int unload_module()
-{
-     struct vpb_pvt *p;
-	/* First, take us out of the channel loop */
-	ast_channel_unregister(type);
-
-	ast_mutex_lock(&iflock); {
-	     /* Hangup all interfaces if they have an owner */
-	     p = iflist;
-	     while(p) {
-		  if (p->owner)
-		       ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
-		  p = p->next;
-	     }
-	     iflist = NULL;
-	} ast_mutex_unlock(&iflock);
-
-	ast_mutex_lock(&monlock); {
-	     if (mthreadactive > -1) {
-		  pthread_cancel(monitor_thread);
-		  pthread_join(monitor_thread, NULL);
-	     }
-	     mthreadactive = -2;
-	} ast_mutex_unlock(&monlock);
-
-	ast_mutex_lock(&iflock); {
-		/* Destroy all the interfaces and free their memory */
-
-		while(iflist) {
-		     p = iflist;		    
-		     ast_mutex_destroy(&p->lock);
-		     pthread_cancel(p->readthread);
-		     p->readthread = 0;
-		     
-		     iflist = iflist->next;
-		     
-		     free(p);
-		}
-		iflist = NULL;
-	} ast_mutex_unlock(&iflock);
-	
-	ast_mutex_lock(&bridge_lock); {
-	     memset(bridges, 0, sizeof bridges);	     
-	} ast_mutex_unlock(&bridge_lock);
-	ast_mutex_destroy(&bridge_lock);
-
-	tcounter = 0;
-	
-	return 0;
 }
 
 int usecount()

Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- chan_zap.c	9 Dec 2003 19:39:47 -0000	1.150
+++ chan_zap.c	9 Dec 2003 23:55:17 -0000	1.151
@@ -6914,7 +6914,7 @@
 	return 0;
 }
 
-static int zt_unload(void)
+static int __unload_module(void)
 {
 	struct zt_pvt *p, *pl;
 	/* First, take us out of the channel loop */
@@ -6977,7 +6977,7 @@
 
 int unload_module()
 {
-	return zt_unload();
+	return __unload_module();
 }
 		
 static int setup_zap(void)
@@ -7016,7 +7016,7 @@
 				ast_log(LOG_ERROR, "Signalling must be specified before any channels are.\n");
 				ast_destroy(cfg);
 				ast_mutex_unlock(&iflock);
-				zt_unload();
+				__unload_module();
 				return -1;
 			}
 			c = v->value;
@@ -7033,7 +7033,7 @@
 					ast_log(LOG_ERROR, "Syntax error parsing '%s' at '%s'\n", v->value, chan);
 					ast_destroy(cfg);
 					ast_mutex_unlock(&iflock);
-					zt_unload();
+					__unload_module();
 					return -1;
 				}
 				if (finish < start) {
@@ -7051,7 +7051,7 @@
 						ast_log(LOG_ERROR, "Unable to register channel '%s'\n", v->value);
 						ast_destroy(cfg);
 						ast_mutex_unlock(&iflock);
-						zt_unload();
+						__unload_module();
 						return -1;
 					}
 				}
@@ -7293,7 +7293,7 @@
 				ast_log(LOG_ERROR, "Unknown switchtype '%s'\n", v->value);
 				ast_destroy(cfg);
 				ast_mutex_unlock(&iflock);
-				zt_unload();
+				__unload_module();
 				return -1;
 			}
 		} else if (!strcasecmp(v->name, "minunused")) {
@@ -7354,12 +7354,12 @@
 	/* Make sure we can register our Zap channel type */
 	if (ast_channel_register(type, tdesc, AST_FORMAT_SLINEAR |  AST_FORMAT_ULAW, zt_request)) {
 		ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
-		zt_unload();
+		__unload_module();
 		return -1;
 	}
 	if (ast_channel_register(typecompat, tdesc, AST_FORMAT_SLINEAR |  AST_FORMAT_ULAW, zt_request)) {
 		ast_log(LOG_ERROR, "Unable to register channel class %s\n", typecompat);
-		zt_unload();
+		__unload_module();
 		return -1;
 	}
 #ifdef ZAPATA_PRI




More information about the svn-commits mailing list