[asterisk-commits] tilghman: branch 1.4 r94765 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 24 10:17:01 CST 2007


Author: tilghman
Date: Mon Dec 24 10:17:01 2007
New Revision: 94765

URL: http://svn.digium.com/view/asterisk?view=rev&rev=94765
Log:
More deadlock avoidance code (this time between sip_monitor and sip_hangup)
Reported by: apsaras
Patch by: tilghman
(Closes issue #11413)

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=94765&r1=94764&r2=94765
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Mon Dec 24 10:17:01 2007
@@ -15497,7 +15497,14 @@
 		   get back to this point every millisecond or less)
 		*/
 		for (sip = iflist; !fastrestart && sip; sip = sip->next) {
-			ast_mutex_lock(&sip->lock);
+			/*! \note If we can't get a lock on an interface, skip it and come
+			 * back later. Note that there is the possibility of a deadlock with
+			 * sip_hangup otherwise, because sip_hangup is called with the channel
+			 * locked first, and the iface lock is attempted second.
+			 */
+			if (ast_mutex_trylock(&sip->lock))
+				continue;
+
 			/* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */
 			if (sip->rtp && sip->owner &&
 			    (sip->owner->_state == AST_STATE_UP) &&




More information about the asterisk-commits mailing list