[asterisk-commits] mmichelson: branch 1.4 r155861 - /branches/1.4/channels/chan_agent.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Nov 10 15:07:39 CST 2008
Author: mmichelson
Date: Mon Nov 10 15:07:39 2008
New Revision: 155861
URL: http://svn.digium.com/view/asterisk?view=rev&rev=155861
Log:
Channel drivers assume that when their indicate callback
is invoked, that the channel on which the callback was called
is locked. This patch corrects an instance in chan_agent where
a channel's indicate callback is called directly without first
locking the channel.
This was leading to some observed locking issues in chan_local,
but considering that all channel drivers operate under the
same expectations, the generic fix in chan_agent is the right
way to go.
AST-126
Modified:
branches/1.4/channels/chan_agent.c
Modified: branches/1.4/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_agent.c?view=diff&rev=155861&r1=155860&r2=155861
==============================================================================
--- branches/1.4/channels/chan_agent.c (original)
+++ branches/1.4/channels/chan_agent.c Mon Nov 10 15:07:39 2008
@@ -666,9 +666,15 @@
struct agent_pvt *p = ast->tech_pvt;
int res = -1;
ast_mutex_lock(&p->lock);
- if (p->chan && !ast_check_hangup(p->chan))
- res = p->chan->tech->indicate ? p->chan->tech->indicate(p->chan, condition, data, datalen) : -1;
- else
+ if (p->chan && !ast_check_hangup(p->chan)) {
+ while (ast_channel_trylock(p->chan)) {
+ ast_channel_unlock(ast);
+ usleep(1);
+ ast_channel_lock(ast);
+ }
+ res = p->chan->tech->indicate ? p->chan->tech->indicate(p->chan, condition, data, datalen) : -1;
+ ast_channel_unlock(p->chan);
+ } else
res = 0;
ast_mutex_unlock(&p->lock);
return res;
More information about the asterisk-commits
mailing list