[asterisk-commits] file: branch file/bridging r79621 - in /team/file/bridging: include/asterisk/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 15 15:30:14 CDT 2007


Author: file
Date: Wed Aug 15 15:30:13 2007
New Revision: 79621

URL: http://svn.digium.com/view/asterisk?view=rev&rev=79621
Log:
Change to a variable to request a rebuild of the bridge. I don't expect more flags would have been needed.

Modified:
    team/file/bridging/include/asterisk/bridging.h
    team/file/bridging/main/bridging.c

Modified: team/file/bridging/include/asterisk/bridging.h
URL: http://svn.digium.com/view/asterisk/team/file/bridging/include/asterisk/bridging.h?view=diff&rev=79621&r1=79620&r2=79621
==============================================================================
--- team/file/bridging/include/asterisk/bridging.h (original)
+++ team/file/bridging/include/asterisk/bridging.h Wed Aug 15 15:30:13 2007
@@ -41,11 +41,6 @@
 	AST_BRIDGE_PREFERENCE_HIGH = 0, /*! Strongly prefer this bridge technology when compared to others */
 	AST_BRIDGE_PREFERENCE_MEDIUM,   /*! Meh, middle - this isn't great but this isn't the best */
 	AST_BRIDGE_PREFERENCE_LOW,      /*! Only use this bridge technology as a last resort */
-};
-
-/*! \brief Flags used to notify the bridge thread of things */
-enum ast_bridge_notify_flags {
-	AST_BRIDGE_NOTIFY_REBUILD = (1 << 0), /*! Someone wants us to rebuild the bridge a bit */
 };
 
 /*! \brief State information about a bridged channel */
@@ -98,7 +93,7 @@
 struct ast_bridge {
 	ast_mutex_t lock;                                    /*! Lock to protect the bridge */
 	int num;                                             /*! Number of channels involved in the bridge */
-	struct ast_flags notify_flags;                       /*! Notify flags, used to indicate that the bridge should do something */
+	int rebuild:1;                                       /*! Something outside wants us to rebuild the bridge data */
 	struct ast_flags feature_flags;                      /*! Feature flags */
 	struct ast_bridge_technology *technology;            /*! Technology in use on the bridge */
 	void *bridge_pvt;                                    /*! Private information unique to the bridge technology (not always needed) */

Modified: team/file/bridging/main/bridging.c
URL: http://svn.digium.com/view/asterisk/team/file/bridging/main/bridging.c?view=diff&rev=79621&r1=79620&r2=79621
==============================================================================
--- team/file/bridging/main/bridging.c (original)
+++ team/file/bridging/main/bridging.c Wed Aug 15 15:30:13 2007
@@ -118,7 +118,7 @@
 		struct ast_bridge_channel *bridge_channel = NULL;
 
 		/* See if we need to rebuild the bridge array information */
-		if (ast_test_flag(&bridge->notify_flags, AST_BRIDGE_NOTIFY_REBUILD)) {
+		if (bridge->rebuild) {
 			struct ast_bridge_channel *bridge_channel = NULL;
 			int i = 0;
 
@@ -133,7 +133,7 @@
 			if (!count)
 				break;
 
-			ast_clear_flag(&bridge->notify_flags, AST_BRIDGE_NOTIFY_REBUILD);
+			bridge->rebuild = 0;
 		} else if (count >= 2) {
 			int i = 0;
 			cs[127] = cs[0];
@@ -304,7 +304,7 @@
 		/* Change thread pointer to indicate it should stop */
 		bridge->thread = AST_PTHREADT_STOP;
 		/* Request that the bridge thread rebuild it's array, this will cause it to see no channels exist and the thread will exit */
-		ast_set_flag(&bridge->notify_flags, AST_BRIDGE_NOTIFY_REBUILD);
+		bridge->rebuild = 1;
 		/* Poke the bridge thread out of it's poll if in it */
 		pthread_kill(thread, SIGURG);
 		/* Give up our lock so that the bridge thread can acquire it */
@@ -479,8 +479,8 @@
 	/* Make the bridged channel part of the bridge */
 	AST_LIST_INSERT_TAIL(&bridge->channels, bridge_channel, list);
 
-	/* Notify the bridge thread that a new bridged channel is part of the bridge, this will cause it to rebuild the bridge array and some critical things */
-	ast_set_flag(&bridge->notify_flags, AST_BRIDGE_NOTIFY_REBUILD);
+	/* Notify the bridge thread that a new bridged channel is part of the bridge, this will cause it to rebuild the bridge array */
+	bridge->rebuild = 1;
 
 	/* Of course if this is the first channel we actually have to create the bridge thread if the technology wants it */
 	if ((bridge->technology->capabilities & AST_BRIDGE_CAPABILITY_THREAD)) {
@@ -668,7 +668,7 @@
 	ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_DEPART);
 
 	/* Queue a rebuild on the bridge itself */
-	ast_set_flag(&bridge->notify_flags, AST_BRIDGE_NOTIFY_REBUILD);
+	bridge->rebuild = 1;
 
 	/* Poke it just in case... */
 	pthread_kill(bridge->thread, SIGURG);




More information about the asterisk-commits mailing list