diff options
author | Richard Mudgett <rmudgett@digium.com> | 2011-02-03 00:29:46 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2011-02-03 00:29:46 +0000 |
commit | f71322f239acc308d713a6a73aed0c6009fb9e77 (patch) | |
tree | ccf2529598d647d5b802c71c3627ed1f294c2c68 /main/channel.c | |
parent | 274032620051cf36d7bca098a85b25ae4a239515 (diff) |
Merged revisions 305923 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r305923 | rmudgett | 2011-02-02 18:24:40 -0600 (Wed, 02 Feb 2011) | 24 lines
Merged revisions 305889 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
................
r305889 | rmudgett | 2011-02-02 18:15:07 -0600 (Wed, 02 Feb 2011) | 17 lines
Merged revisions 305888 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r305888 | rmudgett | 2011-02-02 18:02:43 -0600 (Wed, 02 Feb 2011) | 8 lines
Minor AST_FRAME_TEXT related issues.
* Include the null terminator in the buffer length. When the frame is
queued it is copied. If the null terminator is not part of the frame
buffer length, the receiver could see garbage appended onto it.
* Add channel lock protection with ast_sendtext().
* Fixed AMI SendText action ast_sendtext() return value check.
........
................
................
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@305939 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c index 06ee8bb85..0cabf2d7e 100644 --- a/main/channel.c +++ b/main/channel.c @@ -4466,13 +4466,18 @@ char *ast_recvtext(struct ast_channel *chan, int timeout) int ast_sendtext(struct ast_channel *chan, const char *text) { int res = 0; + + ast_channel_lock(chan); /* Stop if we're a zombie or need a soft hangup */ - if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) + if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) { + ast_channel_unlock(chan); return -1; + } CHECK_BLOCKING(chan); if (chan->tech->send_text) res = chan->tech->send_text(chan, text); ast_clear_flag(chan, AST_FLAG_BLOCKING); + ast_channel_unlock(chan); return res; } |