[asterisk-commits] russell: branch 1.6.1 r141951 - in /branches/1.6.1: ./ main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 8 20:50:49 CDT 2008


Author: russell
Date: Mon Sep  8 20:50:48 2008
New Revision: 141951

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

........
r141949 | russell | 2008-09-08 20:47:56 -0500 (Mon, 08 Sep 2008) | 9 lines

Modify ast_answer() to not hold the channel lock while calling ast_safe_sleep()
or when calling ast_waitfor().  These are inappropriate times to hold the channel
lock.  This is what has caused "could not get the channel lock" messages from
chan_sip and has likely caused a negative impact on performance results of SIP
in Asterisk 1.6.  Thanks to file for pointing out this section of code.

(closes issue #13287)
(closes issue #13115)

........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/main/channel.c

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

Modified: branches/1.6.1/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/main/channel.c?view=diff&rev=141951&r1=141950&r2=141951
==============================================================================
--- branches/1.6.1/main/channel.c (original)
+++ branches/1.6.1/main/channel.c Mon Sep  8 20:50:48 2008
@@ -1674,16 +1674,21 @@
 		return -1;
 	}
 
+	ast_channel_unlock(chan);
+
 	switch (chan->_state) {
 	case AST_STATE_RINGING:
 	case AST_STATE_RING:
-		if (chan->tech->answer)
+		ast_channel_lock(chan);
+		if (chan->tech->answer) {
 			res = chan->tech->answer(chan);
+		}
 		ast_setstate(chan, AST_STATE_UP);
 		ast_cdr_answer(chan->cdr);
-		if (delay)
+		ast_channel_unlock(chan);
+		if (delay) {
 			ast_safe_sleep(chan, delay);
-		else {
+		} else {
 			struct ast_frame *f;
 			int ms = ANSWER_WAIT_MS;
 			while (1) {
@@ -1719,8 +1724,8 @@
 	default:
 		break;
 	}
+
 	chan->visible_indication = 0;
-	ast_channel_unlock(chan);
 
 	return res;
 }




More information about the asterisk-commits mailing list