[asterisk-commits] moy: branch moy/mfcr2-1.4 r235344 - /team/moy/mfcr2-1.4/channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Dec 16 15:00:36 CST 2009


Author: moy
Date: Wed Dec 16 15:00:35 2009
New Revision: 235344

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=235344
Log:
experimental fix for critical bug in CAS signaling processing

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

Modified: team/moy/mfcr2-1.4/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/moy/mfcr2-1.4/channels/chan_dahdi.c?view=diff&rev=235344&r1=235343&r2=235344
==============================================================================
--- team/moy/mfcr2-1.4/channels/chan_dahdi.c (original)
+++ team/moy/mfcr2-1.4/channels/chan_dahdi.c Wed Dec 16 15:00:35 2009
@@ -9478,7 +9478,7 @@
 	struct pollfd pollers[sizeof(mfcr2->pvts)];
 	int maxsleep = 20;
 	int res = 0;
-	int i = 0;
+	int i = 0, j = 0;
 	int pollsize = 0;
 	int oldstate = 0;
 	int was_idle = 0;
@@ -9502,8 +9502,6 @@
 		   the module is loaded */
 		pollsize = 0;
 		for (i = 0; i < mfcr2->numchans; i++) {
-			pollers[i].revents = 0;
-			pollers[i].events = 0;
 			if (mfcr2->pvts[i]->owner) {
 				continue;
 			}
@@ -9513,8 +9511,9 @@
 				break;
 			}
 			openr2_chan_enable_read(mfcr2->pvts[i]->r2chan);
-			pollers[i].events = POLLIN | POLLPRI;
-			pollers[i].fd = mfcr2->pvts[i]->subs[SUB_REAL].dfd;
+			pollers[pollsize].events = POLLIN | POLLPRI;
+			pollers[pollsize].revents = 0;
+			pollers[pollsize].fd = mfcr2->pvts[i]->subs[SUB_REAL].dfd;
 			pollsize++;
 		}
 		if (quit_loop) {
@@ -9542,9 +9541,17 @@
 		} 
 		/* do we want to allow to cancel while processing events? */
 		pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate);
-		for (i = 0; i < mfcr2->numchans; i++) {
-			if (pollers[i].revents & POLLPRI || pollers[i].revents & POLLIN) {
-				openr2_chan_process_event(mfcr2->pvts[i]->r2chan);
+		for (i = 0; i < pollsize; i++) {
+			if (!(pollers[i].revents & POLLPRI) && !(pollers[i].revents & POLLIN)) {
+				continue;
+			}
+			/* search the channel for this fd */
+			for (j = 0; j < mfcr2->numchans; j++) {
+				if (mfcr2->pvts[j]->subs[SUB_REAL].dfd != pollers[i].fd) {
+					continue;
+				}
+				openr2_chan_process_event(mfcr2->pvts[j]->r2chan);
+				break;
 			}
 		}
 		pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &oldstate);




More information about the asterisk-commits mailing list