[Asterisk-cvs] asterisk/channels chan_sip.c,1.392,1.393

markster at lists.digium.com markster at lists.digium.com
Thu May 20 03:39:28 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv3677/channels

Modified Files:
	chan_sip.c 
Log Message:
Stage 1 of deadlock fix (bug #1673 -- but not yet solved, just started) and fix configs ending with no newline (bug #1672)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.392
retrieving revision 1.393
diff -u -d -r1.392 -r1.393
--- chan_sip.c	19 May 2004 03:39:44 -0000	1.392
+++ chan_sip.c	20 May 2004 07:52:07 -0000	1.393
@@ -4538,8 +4538,17 @@
 		p2 = iflist;
 		while(p2) {
 			if (!strcmp(p2->callid, tmp5)) {
-				/* Go ahead and lock it before returning */
+				/* Go ahead and lock it (and its owner) before returning */
 				ast_mutex_lock(&p2->lock);
+				if (p2->owner) {
+					while(ast_mutex_trylock(&p2->owner->lock)) {
+						ast_mutex_unlock(&p2->lock);
+						usleep(1);
+						ast_mutex_lock(&p2->lock);
+						if (!p2->owner)
+							break;
+					}
+				}
 				p->refer_call = p2;
 				break;
 			}
@@ -6471,6 +6480,8 @@
 				if (p->refer_call) {
 					ast_log(LOG_DEBUG,"202 Accepted (supervised)\n");
 					attempt_transfer(p, p->refer_call);
+					if (p->refer_call->owner)
+						ast_mutex_unlock(&p->refer_call->owner->lock);
 					ast_mutex_unlock(&p->refer_call->lock);
 					p->refer_call = NULL;
 					p->gotrefer = 1;




More information about the svn-commits mailing list