[asterisk-commits] twilson: branch 1.8 r365068 - in /branches/1.8: channels/chan_local.c main/cel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 2 12:02:43 CDT 2012


Author: twilson
Date: Wed May  2 12:02:39 2012
New Revision: 365068

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=365068
Log:
Make rmudgett happy

This patch is guaranteed to increase rmudgett's happiness by 20%.

Review: https://reviewboard.asterisk.org/r/1895/

Modified:
    branches/1.8/channels/chan_local.c
    branches/1.8/main/cel.c

Modified: branches/1.8/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_local.c?view=diff&rev=365068&r1=365067&r2=365068
==============================================================================
--- branches/1.8/channels/chan_local.c (original)
+++ branches/1.8/channels/chan_local.c Wed May  2 12:02:39 2012
@@ -1112,6 +1112,9 @@
 		ama = p->owner->amaflags;
 	else
 		ama = 0;
+
+	/* Make sure that the ;2 channel gets the same linkedid as ;1. You can't pass linkedid to both
+	 * allocations since if linkedid isn't set, then each channel will generate its own linkedid. */
 	if (!(tmp = ast_channel_alloc(1, state, 0, 0, t, p->exten, p->context, linkedid, ama, "Local/%s@%s-%04x;1", p->exten, p->context, randnum)) 
 		|| !(tmp2 = ast_channel_alloc(1, AST_STATE_RING, 0, 0, t, p->exten, p->context, tmp->linkedid, ama, "Local/%s@%s-%04x;2", p->exten, p->context, randnum))) {
 		if (tmp) {

Modified: branches/1.8/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/cel.c?view=diff&rev=365068&r1=365067&r2=365068
==============================================================================
--- branches/1.8/main/cel.c (original)
+++ branches/1.8/main/cel.c Wed May  2 12:02:39 2012
@@ -377,10 +377,9 @@
 		return;
 	}
 
-	/* We have a ref for each channel with this linkedid, the link and the above find, so if after
-	 * unreffing for the channel we have a ref of 2, we're done. Unlink and report. */
-	ao2_ref(lid, -1);
-	if (ao2_ref(lid, 0) == 2) {
+	/* We have a ref for each channel with this linkedid, the link and the above find, so if
+	 * before unreffing the channel we have a refcount of 3, we're done. Unlink and report. */
+	if (ao2_ref(lid, -1) == 3) {
 		ao2_unlink(linkedids, lid);
 		ast_cel_report_event(chan, AST_CEL_LINKEDID_END, NULL, NULL, NULL);
 	}
@@ -488,7 +487,11 @@
 				return -1;
 			}
 			strcpy(lid, chan->linkedid);
-			ao2_link(linkedids, lid);
+			if (!ao2_link(linkedids, lid)) {
+				ao2_ref(lid, -1);
+				ast_mutex_unlock(&reload_lock);
+				return -1;
+			}
 			/* Leave both the link and the alloc refs to show a count of 1 + the link */
 		}
 		/* If we've found, go ahead and keep the ref to increment count of how many channels




More information about the asterisk-commits mailing list