[asterisk-commits] russell: branch 1.6.0 r256016 - in /branches/1.6.0: ./ channels/chan_local.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 2 18:47:20 CDT 2010


Author: russell
Date: Fri Apr  2 18:47:16 2010
New Revision: 256016

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=256016
Log:
Merged revisions 256015 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
  r256015 | russell | 2010-04-02 18:46:45 -0500 (Fri, 02 Apr 2010) | 16 lines
  
  Merged revisions 256014 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r256014 | russell | 2010-04-02 18:45:56 -0500 (Fri, 02 Apr 2010) | 9 lines
    
    Resolve a deadlock that occurs due to a pointless call to ast_bridged_channel()
    
    (closes issue #16840)
    Reported by: bzing2
    Patches:
          patch.txt uploaded by bzing2 (license 902)
          issue_16840.rev1.diff uploaded by russell (license 2)
    Tested by: bzing2, russell
  ........
................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/channels/chan_local.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.0/channels/chan_local.c?view=diff&rev=256016&r1=256015&r2=256016
==============================================================================
--- branches/1.6.0/channels/chan_local.c (original)
+++ branches/1.6.0/channels/chan_local.c Fri Apr  2 18:47:16 2010
@@ -252,7 +252,11 @@
 	return res;
 }
 
-static void check_bridge(struct local_pvt *p, int isoutbound)
+/*!
+ * \internal
+ * \note This function assumes that we're only called from the "outbound" local channel side
+ */
+static void check_bridge(struct local_pvt *p)
 {
 	struct ast_channel_monitor *tmp;
 	if (ast_test_flag(p, LOCAL_ALREADY_MASQED) || ast_test_flag(p, LOCAL_NO_OPTIMIZATION) || !p->chan || !p->owner || (p->chan->_bridge != ast_bridged_channel(p->chan)))
@@ -263,7 +267,7 @@
 	   frames on the owner channel (because they would be transferred to the
 	   outbound channel during the masquerade)
 	*/
-	if (isoutbound && p->chan->_bridge /* Not ast_bridged_channel!  Only go one step! */ && AST_LIST_EMPTY(&p->owner->readq)) {
+	if (p->chan->_bridge /* Not ast_bridged_channel!  Only go one step! */ && AST_LIST_EMPTY(&p->owner->readq)) {
 		/* Masquerade bridged channel into owner */
 		/* Lock everything we need, one by one, and give up if
 		   we can't get everything.  Remember, we'll get another
@@ -297,26 +301,6 @@
 				ast_channel_unlock(p->chan->_bridge);
 			}
 		}
-	/* We only allow masquerading in one 'direction'... it's important to preserve the state
-	   (group variables, etc.) that live on p->chan->_bridge (and were put there by the dialplan)
-	   when the local channels go away.
-	*/
-#if 0
-	} else if (!isoutbound && p->owner && p->owner->_bridge && p->chan && AST_LIST_EMPTY(&p->chan->readq)) {
-		/* Masquerade bridged channel into chan */
-		if (!ast_mutex_trylock(&(p->owner->_bridge)->lock)) {
-			if (!ast_check_hangup(p->owner->_bridge)) {
-				if (!ast_mutex_trylock(&p->chan->lock)) {
-					if (!ast_check_hangup(p->chan)) {
-						ast_channel_masquerade(p->chan, p->owner->_bridge);
-						ast_set_flag(p, LOCAL_ALREADY_MASQED);
-					}
-					ast_mutex_unlock(&p->chan->lock);
-				}
-			}
-			ast_mutex_unlock(&(p->owner->_bridge)->lock);
-		}
-#endif
 	}
 }
 
@@ -337,8 +321,8 @@
 	/* Just queue for delivery to the other side */
 	ast_mutex_lock(&p->lock);
 	isoutbound = IS_OUTBOUND(ast, p);
-	if (f && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO))
-		check_bridge(p, isoutbound);
+	if (isoutbound && f && (f->frametype == AST_FRAME_VOICE || f->frametype == AST_FRAME_VIDEO))
+		check_bridge(p);
 	if (!ast_test_flag(p, LOCAL_ALREADY_MASQED))
 		res = local_queue_frame(p, isoutbound, f, ast, 1);
 	else {




More information about the asterisk-commits mailing list