[asterisk-commits] mnicholson: branch 1.8 r281760 - /branches/1.8/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 11 12:28:03 CDT 2010


Author: mnicholson
Date: Wed Aug 11 12:27:59 2010
New Revision: 281760

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281760
Log:
Avoid a deadlock in add_header_max_forwards().

Related to r276951

Modified:
    branches/1.8/channels/chan_sip.c

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=281760&r1=281759&r2=281760
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Wed Aug 11 12:27:59 2010
@@ -9035,8 +9035,16 @@
 	char clen[10];
 	const char *max = NULL;
 
+	/* deadlock avoidance */
+	while (dialog->owner && ast_channel_trylock(dialog->owner)) {
+		sip_pvt_unlock(dialog);
+		usleep(1);
+		sip_pvt_lock(dialog);
+	}
+
 	if (dialog->owner) {
  		max = pbx_builtin_getvar_helper(dialog->owner, "SIP_MAX_FORWARDS");
+		ast_channel_unlock(dialog->owner);
 	}
 
 	/* The channel variable overrides the peer/channel value */




More information about the asterisk-commits mailing list