[asterisk-commits] bbryant: trunk r118562 - /trunk/channels/chan_iax2.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue May 27 14:45:42 CDT 2008


Author: bbryant
Date: Tue May 27 14:45:41 2008
New Revision: 118562

URL: http://svn.digium.com/view/asterisk?view=rev&rev=118562
Log:
Remove loop from the detection of a sequence number that acknowledges 
the receiving of a packet that we've kept in memory just incase the 
packet needs to be retransmitted.

Modified:
    trunk/channels/chan_iax2.c

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=118562&r1=118561&r2=118562
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Tue May 27 14:45:41 2008
@@ -8156,12 +8156,11 @@
 		     (f.frametype != AST_FRAME_IAX))) {
 			unsigned char x;
 			int call_to_destroy;
-			/* XXX This code is not very efficient.  Surely there is a better way which still
-			       properly handles boundary conditions? XXX */
 			/* First we have to qualify that the ACKed value is within our window */
-			for (x=iaxs[fr->callno]->rseqno; x != iaxs[fr->callno]->oseqno; x++)
-				if (fr->iseqno == x)
-					break;
+			if (iaxs[fr->callno]->rseqno >= iaxs[fr->callno]->oseqno || (fr->iseqno >= iaxs[fr->callno]->rseqno && fr->iseqno < iaxs[fr->callno]->oseqno))
+				x = fr->iseqno;
+			else 
+				x = iaxs[fr->callno]->oseqno;
 			if ((x != iaxs[fr->callno]->oseqno) || (iaxs[fr->callno]->oseqno == fr->iseqno)) {
 				/* The acknowledgement is within our window.  Time to acknowledge everything
 				   that it says to */




More information about the asterisk-commits mailing list