[asterisk-commits] oej: branch oej/sip-max-forwards-1.4 r286902 - /team/oej/sip-max-forwards-1.4...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 15 11:59:21 CDT 2010


Author: oej
Date: Wed Sep 15 11:59:16 2010
New Revision: 286902

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=286902
Log:
Backporting deadlock avoidance patch

Modified:
    team/oej/sip-max-forwards-1.4/channels/chan_sip.c

Modified: team/oej/sip-max-forwards-1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/oej/sip-max-forwards-1.4/channels/chan_sip.c?view=diff&rev=286902&r1=286901&r2=286902
==============================================================================
--- team/oej/sip-max-forwards-1.4/channels/chan_sip.c (original)
+++ team/oej/sip-max-forwards-1.4/channels/chan_sip.c Wed Sep 15 11:59:16 2010
@@ -6211,8 +6211,16 @@
 	char clen[10];
 	const char *max = NULL;
 
+	/* deadlock avoidance */
+	while (dialog->owner && ast_channel_trylock(dialog->owner)) {
+		ast_mutex_lock(&dialog->lock);
+		usleep(1);
+		ast_mutex_unlock(&dialog->lock);
+	}
+
 	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