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: https://origsvn.digium.com/svn/asterisk/branches/1.8@324048 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Terry Wilson
2011-06-16 22:35:41 +00:00
parent cf2d1b01be
commit c84e7b911e
4 changed files with 45 additions and 25 deletions

View File

@@ -7387,28 +7387,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 {