[svn-commits] rmudgett: branch rmudgett/bridge_phase r381761 - in /team/rmudgett/bridge_pha...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 19 11:32:14 CST 2013


Author: rmudgett
Date: Tue Feb 19 11:32:09 2013
New Revision: 381761

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381761
Log:
Make bridge technology destroy, leave, and poke_channel callbacks return void.

Modified:
    team/rmudgett/bridge_phase/bridges/bridge_multiplexed.c
    team/rmudgett/bridge_phase/bridges/bridge_softmix.c
    team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h
    team/rmudgett/bridge_phase/main/bridging.c

Modified: team/rmudgett/bridge_phase/bridges/bridge_multiplexed.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/bridges/bridge_multiplexed.c?view=diff&rev=381761&r1=381760&r2=381761
==============================================================================
--- team/rmudgett/bridge_phase/bridges/bridge_multiplexed.c (original)
+++ team/rmudgett/bridge_phase/bridges/bridge_multiplexed.c Tue Feb 19 11:32:09 2013
@@ -188,14 +188,14 @@
 }
 
 /*! \brief Destroy function which unreserves/unreferences/removes a multiplexed thread structure */
-static int multiplexed_bridge_destroy(struct ast_bridge *bridge)
+static void multiplexed_bridge_destroy(struct ast_bridge *bridge)
 {
 	struct multiplexed_thread *muxed_thread;
 	pthread_t thread;
 
 	muxed_thread = bridge->bridge_pvt;
 	if (!muxed_thread) {
-		return -1;
+		return;
 	}
 	bridge->bridge_pvt = NULL;
 
@@ -224,7 +224,6 @@
 	}
 
 	ao2_ref(muxed_thread, -1);
-	return 0;
 }
 
 /*! \brief Thread function that executes for multiplexed threads */
@@ -420,15 +419,13 @@
 }
 
 /*! \brief Leave function which actually removes the channel from the array */
-static int multiplexed_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+static void multiplexed_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
 	struct multiplexed_thread *muxed_thread = bridge->bridge_pvt;
 
 	ast_debug(1, "Removing channel '%s' from multiplexed thread '%p'\n", ast_channel_name(bridge_channel->chan), muxed_thread);
 
 	multiplexed_chan_remove(muxed_thread, bridge_channel->chan);
-
-	return 0;
 }
 
 /*! \brief Suspend function which means control of the channel is going elsewhere */

Modified: team/rmudgett/bridge_phase/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/bridges/bridge_softmix.c?view=diff&rev=381761&r1=381760&r2=381761
==============================================================================
--- team/rmudgett/bridge_phase/bridges/bridge_softmix.c (original)
+++ team/rmudgett/bridge_phase/bridges/bridge_softmix.c Tue Feb 19 11:32:09 2013
@@ -327,17 +327,16 @@
 }
 
 /*! \brief Function called when a bridge is destroyed */
-static int softmix_bridge_destroy(struct ast_bridge *bridge)
+static void softmix_bridge_destroy(struct ast_bridge *bridge)
 {
 	struct softmix_bridge_data *softmix_data;
 
 	softmix_data = bridge->bridge_pvt;
 	if (!softmix_data) {
-		return -1;
+		return;
 	}
 	ao2_ref(softmix_data, -1);
 	bridge->bridge_pvt = NULL;
-	return 0;
 }
 
 static void set_softmix_bridge_data(int rate, int interval, struct ast_bridge_channel *bridge_channel, int reset)
@@ -407,12 +406,12 @@
 }
 
 /*! \brief Function called when a channel leaves the bridge */
-static int softmix_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+static void softmix_bridge_leave(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
 	struct softmix_channel *sc = bridge_channel->bridge_pvt;
 
 	if (!(bridge_channel->bridge_pvt)) {
-		return 0;
+		return;
 	}
 	bridge_channel->bridge_pvt = NULL;
 
@@ -427,8 +426,6 @@
 
 	/* Eep! drop ourselves */
 	ast_free(sc);
-
-	return 0;
 }
 
 /*!
@@ -598,7 +595,7 @@
 }
 
 /*! \brief Function called when the channel's thread is poked */
-static int softmix_bridge_poke_channel(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
+static void softmix_bridge_poke_channel(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
 {
 	struct softmix_channel *sc = bridge_channel->bridge_pvt;
 
@@ -610,8 +607,6 @@
 	}
 
 	ast_mutex_unlock(&sc->lock);
-
-	return 0;
 }
 
 static void gather_softmix_stats(struct softmix_stats *stats,

Modified: team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h?view=diff&rev=381761&r1=381760&r2=381761
==============================================================================
--- team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h (original)
+++ team/rmudgett/bridge_phase/include/asterisk/bridging_technology.h Tue Feb 19 11:32:09 2013
@@ -52,11 +52,11 @@
 	/*! Callback for when a bridge is being created */
 	int (*create)(struct ast_bridge *bridge);
 	/*! Callback for when a bridge is being destroyed */
-	int (*destroy)(struct ast_bridge *bridge);
+	void (*destroy)(struct ast_bridge *bridge);
 	/*! Callback for when a channel is being added to a bridge */
 	int (*join)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
 	/*! Callback for when a channel is leaving a bridge */
-	int (*leave)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
+	void (*leave)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
 	/*! Callback for when a channel is suspended from the bridge */
 	void (*suspend)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
 	/*! Callback for when a channel is unsuspended from the bridge */
@@ -70,7 +70,7 @@
 	/*! Callback for replacement thread function */
 	int (*thread)(struct ast_bridge *bridge);
 	/*! Callback for poking a bridge channel thread */
-	int (*poke_channel)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
+	void (*poke_channel)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
 	/*! Formats that the bridge technology supports */
 	struct ast_format_cap *format_capabilities;
 	/*! TRUE if the bridge technology is currently suspended. */

Modified: team/rmudgett/bridge_phase/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/rmudgett/bridge_phase/main/bridging.c?view=diff&rev=381761&r1=381760&r2=381761
==============================================================================
--- team/rmudgett/bridge_phase/main/bridging.c (original)
+++ team/rmudgett/bridge_phase/main/bridging.c Tue Feb 19 11:32:09 2013
@@ -679,10 +679,7 @@
 	/* Pass off the bridge to the technology to destroy if needed */
 	if (bridge->technology->destroy) {
 		ast_debug(1, "Giving bridge technology %s the bridge structure %p to destroy\n", bridge->technology->name, bridge);
-		if (bridge->technology->destroy(bridge)) {
-			ast_debug(1, "Bridge technology %s failed to destroy bridge structure %p... some memory may have leaked\n",
-				bridge->technology->name, bridge);
-		}
+		bridge->technology->destroy(bridge);
 	}
 
 	cleanup_video_mode(bridge);
@@ -936,10 +933,7 @@
 		if (old_technology->leave) {
 			ast_debug(1, "Giving bridge technology %s notification that %p is leaving bridge %p (really %p)\n",
 				old_technology->name, bridge_channel2, &temp_bridge, bridge);
-			if (old_technology->leave(&temp_bridge, bridge_channel2)) {
-				ast_debug(1, "Bridge technology %s failed to allow %p (really %p) to leave bridge %p\n",
-					old_technology->name, bridge_channel2, &temp_bridge, bridge);
-			}
+			old_technology->leave(&temp_bridge, bridge_channel2);
 		}
 
 		/* Second we make them compatible again with the bridge */
@@ -971,10 +965,7 @@
 	if (old_technology->destroy) {
 		ast_debug(1, "Giving bridge technology %s the bridge structure %p (really %p) to destroy\n",
 			old_technology->name, &temp_bridge, bridge);
-		if (old_technology->destroy(&temp_bridge)) {
-			ast_debug(1, "Bridge technology %s failed to destroy bridge structure %p (really %p)... some memory may have leaked\n",
-				old_technology->name, &temp_bridge, bridge);
-		}
+		old_technology->destroy(&temp_bridge);
 	}
 
 	/* Finally if the old technology has module referencing remove our reference, we are no longer going to use it */
@@ -1354,9 +1345,11 @@
 
 	/* Tell the bridge technology we are joining so they set us up */
 	if (bridge_channel->bridge->technology->join) {
-		ast_debug(1, "Giving bridge technology %s notification that %p is joining bridge %p\n", bridge_channel->bridge->technology->name, bridge_channel, bridge_channel->bridge);
+		ast_debug(1, "Giving bridge technology %s notification that %p is joining bridge %p\n",
+			bridge_channel->bridge->technology->name, bridge_channel, bridge_channel->bridge);
 		if (bridge_channel->bridge->technology->join(bridge_channel->bridge, bridge_channel)) {
-			ast_debug(1, "Bridge technology %s failed to join %p to bridge %p\n", bridge_channel->bridge->technology->name, bridge_channel, bridge_channel->bridge);
+			ast_debug(1, "Bridge technology %s failed to join %p to bridge %p\n",
+				bridge_channel->bridge->technology->name, bridge_channel, bridge_channel->bridge);
 		}
 	}
 
@@ -1445,10 +1438,9 @@
 
 	/* Tell the bridge technology we are leaving so they tear us down */
 	if (bridge_channel->bridge->technology->leave) {
-		ast_debug(1, "Giving bridge technology %s notification that %p is leaving bridge %p\n", bridge_channel->bridge->technology->name, bridge_channel, bridge_channel->bridge);
-		if (bridge_channel->bridge->technology->leave(bridge_channel->bridge, bridge_channel)) {
-			ast_debug(1, "Bridge technology %s failed to leave %p from bridge %p\n", bridge_channel->bridge->technology->name, bridge_channel, bridge_channel->bridge);
-		}
+		ast_debug(1, "Giving bridge technology %s notification that %p is leaving bridge %p\n",
+			bridge_channel->bridge->technology->name, bridge_channel, bridge_channel->bridge);
+		bridge_channel->bridge->technology->leave(bridge_channel->bridge, bridge_channel);
 	}
 
 	/* Remove channel from the bridge */
@@ -2120,10 +2112,9 @@
 	while ((bridge_channel = AST_LIST_REMOVE_HEAD(&bridge1->channels, entry))) {
 		/* Tell the technology handling bridge1 that the bridge channel is leaving */
 		if (bridge1->technology->leave) {
-			ast_debug(1, "Giving bridge technology %s notification that %p is leaving bridge %p\n", bridge1->technology->name, bridge_channel, bridge1);
-			if (bridge1->technology->leave(bridge1, bridge_channel)) {
-				ast_debug(1, "Bridge technology %s failed to allow %p to leave bridge %p\n", bridge1->technology->name, bridge_channel, bridge1);
-			}
+			ast_debug(1, "Giving bridge technology %s notification that %p is leaving bridge %p\n",
+				bridge1->technology->name, bridge_channel, bridge1);
+			bridge1->technology->leave(bridge1, bridge_channel);
 		}
 
 		/* Drop channel count and reference count on the bridge they are leaving */
@@ -2145,9 +2136,11 @@
 
 		/* Tell the technology handling bridge0 that the bridge channel is joining */
 		if (bridge0->technology->join) {
-			ast_debug(1, "Giving bridge technology %s notification that %p is joining bridge %p\n", bridge0->technology->name, bridge_channel, bridge0);
+			ast_debug(1, "Giving bridge technology %s notification that %p is joining bridge %p\n",
+				bridge0->technology->name, bridge_channel, bridge0);
 			if (bridge0->technology->join(bridge0, bridge_channel)) {
-				ast_debug(1, "Bridge technology %s failed to join %p to bridge %p\n", bridge0->technology->name, bridge_channel, bridge0);
+				ast_debug(1, "Bridge technology %s failed to join %p to bridge %p\n",
+					bridge0->technology->name, bridge_channel, bridge0);
 			}
 		}
 




More information about the svn-commits mailing list