[asterisk-commits] kmoore: branch kmoore/stasis-bridge_events r385266 - in /team/kmoore/stasis-b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 10 14:03:07 CDT 2013


Author: kmoore
Date: Wed Apr 10 14:03:03 2013
New Revision: 385266

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385266
Log:
Multiple revisions 385238,385255

........
  r385238 | root | 2013-04-10 11:17:20 -0500 (Wed, 10 Apr 2013) | 8 lines
  
  Fixed manager channelvars support.
  
  For the events that have been ported to Stasis, this was broken in
  r384910, when a couple of lines of code was lost in a merge.
  ........
  
  Merged revisions 385236 from file:///srv/subversion/repos/asterisk/trunk
........
  r385255 | rmudgett | 2013-04-10 12:27:59 -0500 (Wed, 10 Apr 2013) | 10 lines
  
  confbridge: Fix announcer channel bridge depart getting stuck.
  
  When the announcer channel needs to depart from the bridge, the thread
  needs to be poked to get it out of an indefinite wait for media.
  Unfortunately, this fix does not guarantee that ast_bridge_depart() will
  not get stuck waiting for the bridge channel thread to die.  Thres is a
  small window of opportunity in bridge_channel_wait() where the thread is
  about to enter the ast_waitfor_nandfds() when the thread poke will be
  ignored.
........

Merged revisions 385238,385255 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction
........

Merged revisions 385265 from http://svn.asterisk.org/svn/asterisk/team/kmoore/stasis-bridging-channel_events

Modified:
    team/kmoore/stasis-bridge_events/   (props changed)
    team/kmoore/stasis-bridge_events/bridges/bridge_softmix.c
    team/kmoore/stasis-bridge_events/main/bridging.c
    team/kmoore/stasis-bridge_events/main/stasis_channels.c

Propchange: team/kmoore/stasis-bridge_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 10 14:03:03 2013
@@ -1,1 +1,1 @@
-/team/kmoore/stasis-bridging-channel_events:1-385234
+/team/kmoore/stasis-bridging-channel_events:1-385265

Modified: team/kmoore/stasis-bridge_events/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/bridges/bridge_softmix.c?view=diff&rev=385266&r1=385265&r2=385266
==============================================================================
--- team/kmoore/stasis-bridge_events/bridges/bridge_softmix.c (original)
+++ team/kmoore/stasis-bridge_events/bridges/bridge_softmix.c Wed Apr 10 14:03:03 2013
@@ -1080,6 +1080,7 @@
 	softmix_data->thread = AST_PTHREADT_NULL;
 	ast_mutex_unlock(&softmix_data->lock);
 	if (thread != AST_PTHREADT_NULL) {
+		ast_debug(1, "Waiting for mixing thread to die.\n");
 		pthread_join(thread, NULL);
 	}
 

Modified: team/kmoore/stasis-bridge_events/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/bridging.c?view=diff&rev=385266&r1=385265&r2=385266
==============================================================================
--- team/kmoore/stasis-bridge_events/main/bridging.c (original)
+++ team/kmoore/stasis-bridge_events/main/bridging.c Wed Apr 10 14:03:03 2013
@@ -216,6 +216,14 @@
 		}
 		ast_bridge_unlock(bridge);
 		ao2_ref(bridge, -1);
+	}
+}
+
+static void bridge_channel_poke(struct ast_bridge_channel *bridge_channel)
+{
+	if (!pthread_equal(pthread_self(), bridge_channel->thread)) {
+		pthread_kill(bridge_channel->thread, SIGURG);
+		ast_cond_signal(&bridge_channel->cond);
 	}
 }
 
@@ -2950,9 +2958,21 @@
 
 	/* We are claiming the reference held by the depart thread. */
 
-	ast_bridge_change_state(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+	ast_bridge_channel_lock(bridge_channel);
+	ast_bridge_change_state_nolock(bridge_channel, AST_BRIDGE_CHANNEL_STATE_HANGUP);
+
+/* BUGBUG hack alert ast_bridge_depart() may fail to return because of a race condition. */
+	/*
+	 * XXX The poke is a bit of a hack since there is a race
+	 * condition in bridge_channel_wait() when it is just about to
+	 * enter ast_waitfor_nandfds() and we poke the thread.
+	 */
+	bridge_channel_poke(bridge_channel);
+	ast_bridge_channel_unlock(bridge_channel);
 
 	/* Wait for the depart thread to die */
+	ast_debug(1, "Waiting for %p(%s) bridge thread to die.\n",
+		bridge_channel, ast_channel_name(bridge_channel->chan));
 	pthread_join(bridge_channel->thread, NULL);
 
 	ast_channel_lock(chan);
@@ -3981,6 +4001,7 @@
 		manager->stop = 1;
 		ast_cond_signal(&manager->cond);
 		ao2_unlock(manager);
+		ast_debug(1, "Waiting for bridge manager thread to die.\n");
 		pthread_join(manager->thread, NULL);
 	}
 

Modified: team/kmoore/stasis-bridge_events/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/stasis_channels.c?view=diff&rev=385266&r1=385265&r2=385266
==============================================================================
--- team/kmoore/stasis-bridge_events/main/stasis_channels.c (original)
+++ team/kmoore/stasis-bridge_events/main/stasis_channels.c Wed Apr 10 14:03:03 2013
@@ -153,6 +153,9 @@
 	snapshot->amaflags = ast_channel_amaflags(chan);
 	snapshot->hangupcause = ast_channel_hangupcause(chan);
 	snapshot->flags = *ast_channel_flags(chan);
+	snapshot->caller_pres = ast_party_id_presentation(&ast_channel_caller(chan)->id);
+
+	snapshot->manager_vars = ast_channel_get_manager_vars(chan);
 
 	ao2_ref(snapshot, +1);
 	return snapshot;




More information about the asterisk-commits mailing list