[asterisk-commits] russell: branch 1.8 r317865 - /branches/1.8/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 6 14:46:55 CDT 2011


Author: russell
Date: Fri May  6 14:46:49 2011
New Revision: 317865

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=317865
Log:
chan_sip: fix a deadlock in check_rtp_timeout.

Don't block doing silly deadlock avoidance.  Just return and try again later.
The funciton gets called often enough that it's fine.  Also, this change was
already made in trunk.

(closes issue #18791)
Reported by: irroot
Patches:
      chan_sip.rtptimeout.patch uploaded by irroot (license 52)

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=317865&r1=317864&r2=317865
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Fri May  6 14:46:49 2011
@@ -24603,13 +24603,12 @@
 		if (!ast_test_flag(&dialog->flags[1], SIP_PAGE2_CALL_ONHOLD) || (ast_rtp_instance_get_hold_timeout(dialog->rtp) && (t > dialog->lastrtprx + ast_rtp_instance_get_hold_timeout(dialog->rtp)))) {
 			/* Needs a hangup */
 			if (ast_rtp_instance_get_timeout(dialog->rtp)) {
-				while (dialog->owner && ast_channel_trylock(dialog->owner)) {
-					sip_pvt_unlock(dialog);
-					usleep(1);
-					sip_pvt_lock(dialog);
-				}
-				if (!dialog->owner) {
-					return; /* channel hangup can occur during deadlock avoidance. */
+				if (!dialog->owner || ast_channel_trylock(dialog->owner)) {
+					/*
+					 * Don't block, just try again later.
+					 * If there was no owner, the call is dead already.
+					 */
+					return;
 				}
 				ast_log(LOG_NOTICE, "Disconnecting call '%s' for lack of RTP activity in %ld seconds\n",
 					dialog->owner->name, (long) (t - dialog->lastrtprx));




More information about the asterisk-commits mailing list