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

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Mar 6 17:07:28 MST 2006


Author: tilghman
Date: Mon Mar  6 18:07:27 2006
New Revision: 12197

URL: http://svn.digium.com/view/asterisk?rev=12197&view=rev
Log:
Merged revisions 12195 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r12195 | tilghman | 2006-03-06 18:05:27 -0600 (Mon, 06 Mar 2006) | 2 lines

Bug 6020 - Race condition where packet could be lost if first packet on list is acked

........

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

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

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=12197&r1=12196&r2=12197&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Mar  6 18:07:27 2006
@@ -1426,12 +1426,12 @@
 
 	msg = sip_methods[sipmethod].text;
 
+	ast_mutex_lock(&p->lock);
 	cur = p->packets;
 	while(cur) {
 		if ((cur->seqno == seqno) && ((ast_test_flag(cur, FLAG_RESPONSE)) == resp) &&
 			((ast_test_flag(cur, FLAG_RESPONSE)) || 
 			 (!strncasecmp(msg, cur->data, strlen(msg)) && (cur->data[strlen(msg)] < 33)))) {
-			ast_mutex_lock(&p->lock);
 			if (!resp && (seqno == p->pendinginvite)) {
 				ast_log(LOG_DEBUG, "Acked pending invite %d\n", p->pendinginvite);
 				p->pendinginvite = 0;
@@ -1447,13 +1447,13 @@
 				ast_sched_del(sched, cur->retransid);
 			}
 			free(cur);
-			ast_mutex_unlock(&p->lock);
 			res = 0;
 			break;
 		}
 		prev = cur;
 		cur = cur->next;
 	}
+	ast_mutex_unlock(&p->lock);
 	if (option_debug)
 		ast_log(LOG_DEBUG, "Stopping retransmission on '%s' of %s %d: Match %s\n", p->callid, resp ? "Response" : "Request", seqno, res ? "Not Found" : "Found");
 	return res;



More information about the asterisk-commits mailing list