[asterisk-commits] dvossel: trunk r236063 - in /trunk: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Dec 22 11:00:11 CST 2009


Author: dvossel
Date: Tue Dec 22 11:00:08 2009
New Revision: 236063

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=236063
Log:
Merged revisions 236062 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r236062 | dvossel | 2009-12-22 10:58:19 -0600 (Tue, 22 Dec 2009) | 11 lines
  
  fixes issue with p->method incorrectly set to ACK
  
  It is possible for a second ACK to come in for a retransmitted message.
  If an ack does not match an unacked message in our queue, restore the previous
  p->method as this ACK is completely ignored.
  
  (closes issue #16295)
  Reported by: omolenkamp
  Patches:
        issue16295_v2.diff uploaded by dvossel (license 671)
........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=236063&r1=236062&r2=236063
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Dec 22 11:00:08 2009
@@ -22652,6 +22652,8 @@
 	int debug = sip_debug_test_pvt(p);
 	const char *e;
 	int error = 0;
+	int oldmethod = p->method;
+	int acked = 0;
 
 	/* Get Method and Cseq */
 	cseq = get_header(req, "Cseq");
@@ -22827,7 +22829,7 @@
 		if (seqno == p->pendinginvite) {
 			p->invitestate = INV_TERMINATED;
 			p->pendinginvite = 0;
-			__sip_ack(p, seqno, 1 /* response */, 0);
+			acked = __sip_ack(p, seqno, 1 /* response */, 0);
 			if (find_sdp(req)) {
 				if (process_sdp(p, req, SDP_T38_NONE))
 					return -1;
@@ -22836,9 +22838,13 @@
 		} else if (p->glareinvite == seqno) {
 			/* handle ack for the 491 pending sent for glareinvite */
 			p->glareinvite = 0;
-			__sip_ack(p, seqno, 1, 0);
-		}
-		/* Got an ACK that we did not match. Ignore silently */
+			acked = __sip_ack(p, seqno, 1, 0);
+		}
+		if (!acked) {
+			/* Got an ACK that did not match anything. Ignore
+			 * silently and restore previous method */
+			p->method = oldmethod;
+		}
 		if (!p->lastinvite && ast_strlen_zero(p->randdata)) {
 			pvt_set_needdestroy(p, "unmatched ACK");
 		}




More information about the asterisk-commits mailing list