aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2011-06-16 22:49:49 +0000
committertwilson <twilson@f38db490-d61c-443f-a65b-d21fe96a405b>2011-06-16 22:49:49 +0000
commit62b90dd0a4ea809bdb11bc27288b6acf717edcd8 (patch)
treeb2aaf8bd69e1f83f2b40fa94e3fddeb927b658b9 /main
parentf81499e93954a8a4ca7993374e10398b063f4eab (diff)
Merged revisions 324048 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r324048 | twilson | 2011-06-16 17:35:41 -0500 (Thu, 16 Jun 2011) | 8 lines Lock the channel before calling the setoption callback The channel needs to be locked before calling these callback functions. Also, sip_setoption needs to lock the pvt and a check p->rtp is non-null before using it. Review: https://reviewboard.asterisk.org/r/1220/ ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@324050 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/main/channel.c b/main/channel.c
index 47ebe9b80..57629dbc5 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -7608,28 +7608,42 @@ enum ast_bridge_result ast_channel_bridge(struct ast_channel *c0, struct ast_cha
/*! \brief Sets an option on a channel */
int ast_channel_setoption(struct ast_channel *chan, int option, void *data, int datalen, int block)
{
+ int res;
+
+ ast_channel_lock(chan);
if (!chan->tech->setoption) {
errno = ENOSYS;
+ ast_channel_unlock(chan);
return -1;
}
if (block)
ast_log(LOG_ERROR, "XXX Blocking not implemented yet XXX\n");
- return chan->tech->setoption(chan, option, data, datalen);
+ res = chan->tech->setoption(chan, option, data, datalen);
+ ast_channel_unlock(chan);
+
+ return res;
}
int ast_channel_queryoption(struct ast_channel *chan, int option, void *data, int *datalen, int block)
{
+ int res;
+
+ ast_channel_lock(chan);
if (!chan->tech->queryoption) {
errno = ENOSYS;
+ ast_channel_unlock(chan);
return -1;
}
if (block)
ast_log(LOG_ERROR, "XXX Blocking not implemented yet XXX\n");
- return chan->tech->queryoption(chan, option, data, datalen);
+ res = chan->tech->queryoption(chan, option, data, datalen);
+ ast_channel_unlock(chan);
+
+ return res;
}
struct tonepair_def {