[svn-commits] moy: branch moy/mfcr2-1.4 r129906 - /team/moy/mfcr2-1.4/channels/chan_zap.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 10 23:48:18 CDT 2008


Author: moy
Date: Thu Jul 10 23:48:18 2008
New Revision: 129906

URL: http://svn.digium.com/view/asterisk?view=rev&rev=129906
Log:
added proper locking and setting of mfcr2call when requesting an outgoing channel

Modified:
    team/moy/mfcr2-1.4/channels/chan_zap.c

Modified: team/moy/mfcr2-1.4/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/moy/mfcr2-1.4/channels/chan_zap.c?view=diff&rev=129906&r1=129905&r2=129906
==============================================================================
--- team/moy/mfcr2-1.4/channels/chan_zap.c (original)
+++ team/moy/mfcr2-1.4/channels/chan_zap.c Thu Jul 10 23:48:18 2008
@@ -8165,6 +8165,7 @@
 		}
 #endif
 #ifdef HAVE_OPENR2
+		/* Trust MFC/R2 */
 		if (p->mfcr2) {
 			if (p->mfcr2call)
 				return 0;
@@ -8447,6 +8448,19 @@
 				}
 			}
 #endif			
+#ifdef HAVE_OPENR2
+			if (p->mfcr2) {
+				ast_mutex_lock(&p->lock);
+				if (p->mfcr2call) {
+					ast_log(LOG_DEBUG, "Yay!, someone just beat us in the race for channel %d.\n", p->channel);
+					ast_mutex_unlock(&p->lock);
+					goto next;
+				}
+				p->mfcr2call = 1;
+				ast_mutex_unlock(&p->lock);
+				zt_r2_update_monitor_count(p->mfcr2, 0);
+			}
+#endif
 			if (p->channel == CHAN_PSEUDO) {
 				p = chandup(p);
 				if (!p) {
@@ -8461,11 +8475,6 @@
 			}
 			p->outgoing = 1;
 			tmp = zt_new(p, AST_STATE_RESERVED, 0, p->owner ? SUB_CALLWAIT : SUB_REAL, 0, 0);
-#ifdef HAVE_OPENR2
-			if (p->mfcr2) {
-				zt_r2_update_monitor_count(p->mfcr2, 0);
-			}
-#endif
 #ifdef HAVE_PRI
 			if (p->bearer) {
 				/* Log owner to bearer channel, too */




More information about the svn-commits mailing list