[asterisk-commits] file: branch file/bridging r172269 - /team/file/bridging/bridges/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 29 07:22:48 CST 2009


Author: file
Date: Thu Jan 29 07:22:48 2009
New Revision: 172269

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=172269
Log:
Add code to only move channels around if one was actually removed. It is possible for this to happen if the state goes feature -> hangup/depart. Since the feature activation would have removed them already removing them a second time won't work.

Modified:
    team/file/bridging/bridges/bridge_multiplexed.c

Modified: team/file/bridging/bridges/bridge_multiplexed.c
URL: http://svn.digium.com/svn-view/asterisk/team/file/bridging/bridges/bridge_multiplexed.c?view=diff&rev=172269&r1=172268&r2=172269
==============================================================================
--- team/file/bridging/bridges/bridge_multiplexed.c (original)
+++ team/file/bridging/bridges/bridge_multiplexed.c Thu Jan 29 07:22:48 2009
@@ -186,7 +186,7 @@
 /*! \brief Helper function which adds or removes a channel and nudges the thread */
 static void multiplexed_add_or_remove(struct multiplexed_thread *multiplexed_thread, struct ast_channel *chan, int add)
 {
-	int i;
+	int i, removed = 0;
 
 	ao2_lock(multiplexed_thread);
 
@@ -197,6 +197,7 @@
 			if (!add) {
 				multiplexed_thread->chans[i] = NULL;
 				multiplexed_thread->service_count--;
+				removed = 1;
 			}
 			break;
 		} else if (!multiplexed_thread->chans[i] && add) {
@@ -214,7 +215,7 @@
 		}
 	} else if (!multiplexed_thread->service_count && multiplexed_thread->thread != AST_PTHREADT_NULL) {
 		multiplexed_thread->thread = AST_PTHREADT_STOP;
-	} else if (!add) {
+	} else if (!add && removed) {
 		memmove(multiplexed_thread->chans + i, multiplexed_thread->chans + i + 1, sizeof(struct ast_channel *) * (MULTIPLEXED_MAX_CHANNELS - (i + 1)));
 	}
 




More information about the asterisk-commits mailing list