[asterisk-commits] tilghman: branch 1.6.0 r107999 - in /branches/1.6.0: ./ channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 12 02:44:29 CDT 2008


Author: tilghman
Date: Wed Mar 12 02:44:28 2008
New Revision: 107999

URL: http://svn.digium.com/view/asterisk?view=rev&rev=107999
Log:
Merged revisions 107998 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r107998 | tilghman | 2008-03-12 02:43:03 -0500 (Wed, 12 Mar 2008) | 7 lines

Deadlock fixes
(closes issue #12143)
 Reported by: kactus
 Patches: 
       20080312__bug12143__2.diff.txt uploaded by Corydon76 (license 14)
 Tested by: kactus

........

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/channels/chan_sip.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/channels/chan_sip.c?view=diff&rev=107999&r1=107998&r2=107999
==============================================================================
--- branches/1.6.0/channels/chan_sip.c (original)
+++ branches/1.6.0/channels/chan_sip.c Wed Mar 12 02:44:28 2008
@@ -2250,6 +2250,7 @@
 }
 
 #define sip_pvt_lock(x) ast_mutex_lock(&x->pvt_lock)
+#define sip_pvt_trylock(x) ast_mutex_trylock(&x->pvt_lock)
 #define sip_pvt_unlock(x) ast_mutex_unlock(&x->pvt_lock)
 
 /*!
@@ -5839,6 +5840,7 @@
 	}
 
 	dialoglist_lock();
+restartsearch:
 	for (p = dialoglist; p; p = p->next) {
 		/* In pedantic, we do not want packets with bad syntax to be connected to a PVT */
 		int found = FALSE;
@@ -5869,7 +5871,12 @@
 
 		if (found) {
 			/* Found the call */
-			sip_pvt_lock(p);
+			if (sip_pvt_trylock(p)) {
+				dialoglist_unlock();
+				usleep(1);
+				dialoglist_lock();
+				goto restartsearch;
+			}
 			dialoglist_unlock();
 			return p;
 		}
@@ -18339,7 +18346,13 @@
 		   get back to this point every millisecond or less)
 		*/
 		for (dialog = dialoglist; dialog; dialog = dialog->next) {
-			sip_pvt_lock(dialog);
+			if (sip_pvt_trylock(dialog)) {
+				dialoglist_unlock();
+				usleep(1);
+				dialoglist_lock();
+				goto restartsearch;
+			}
+
 			/* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */
 			check_rtp_timeout(dialog, t);
 			/* If we have sessions that needs to be destroyed, do it now */




More information about the asterisk-commits mailing list