[svn-commits] rmudgett: branch group/bridge_construction r386014 - in /team/group/bridge_co...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Apr 18 11:24:05 CDT 2013


Author: rmudgett
Date: Thu Apr 18 11:24:03 2013
New Revision: 386014

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386014
Log:
Fix deadlock potential when dissolving a bridge.

Modified:
    team/group/bridge_construction/include/asterisk/bridging.h
    team/group/bridge_construction/main/bridging.c

Modified: team/group/bridge_construction/include/asterisk/bridging.h
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/include/asterisk/bridging.h?view=diff&rev=386014&r1=386013&r2=386014
==============================================================================
--- team/group/bridge_construction/include/asterisk/bridging.h (original)
+++ team/group/bridge_construction/include/asterisk/bridging.h Thu Apr 18 11:24:03 2013
@@ -205,6 +205,8 @@
 
 	/*! Bridge reconfiguration deferred technology destruction. */
 	AST_BRIDGE_ACTION_DEFERRED_TECH_DESTROY = 1000,
+	/*! Bridge deferred dissolving. */
+	AST_BRIDGE_ACTION_DEFERRED_DISSOLVING,
 };
 
 enum ast_bridge_video_mode_type {
@@ -261,6 +263,8 @@
  * \details
  * The bridge is being dissolved.  Remove any external
  * references to the bridge so it can be destroyed.
+ *
+ * \note On entry, self must NOT be locked.
  *
  * \return Nothing
  */

Modified: team/group/bridge_construction/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/group/bridge_construction/main/bridging.c?view=diff&rev=386014&r1=386013&r2=386014
==============================================================================
--- team/group/bridge_construction/main/bridging.c (original)
+++ team/group/bridge_construction/main/bridging.c Thu Apr 18 11:24:03 2013
@@ -418,6 +418,10 @@
 static void bridge_dissolve(struct ast_bridge *bridge)
 {
 	struct ast_bridge_channel *bridge_channel;
+	struct ast_frame action = {
+		.frametype = AST_FRAME_BRIDGE_ACTION,
+		.subclass.integer = AST_BRIDGE_ACTION_DEFERRED_DISSOLVING,
+	};
 
 	if (bridge->dissolved) {
 		return;
@@ -430,7 +434,9 @@
 	AST_LIST_TRAVERSE(&bridge->channels, bridge_channel, entry) {
 		ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
 	}
-	bridge->v_table->dissolving(bridge);
+
+	/* Must defer dissolving bridge because it is already locked. */
+	ast_bridge_queue_action(bridge, &action);
 }
 
 /*!
@@ -1110,6 +1116,11 @@
 	case AST_BRIDGE_ACTION_DEFERRED_TECH_DESTROY:
 		ast_bridge_unlock(bridge);
 		bridge_tech_deferred_destroy(bridge, action);
+		ast_bridge_lock(bridge);
+		break;
+	case AST_BRIDGE_ACTION_DEFERRED_DISSOLVING:
+		ast_bridge_unlock(bridge);
+		bridge->v_table->dissolving(bridge);
 		ast_bridge_lock(bridge);
 		break;
 	default:




More information about the svn-commits mailing list