diff options
author | Russell Bryant <russell@russellbryant.com> | 2008-02-19 20:06:23 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2008-02-19 20:06:23 +0000 |
commit | 85cd43c3c90485c32887bc60d3bd3e992b6c06e6 (patch) | |
tree | 3d93f4f17afc3f843d508f0cce7779db22a6177b | |
parent | a966ef74b789a461eb50447523fddb81b5555834 (diff) |
Merged revisions 103821 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r103821 | russell | 2008-02-19 14:02:49 -0600 (Tue, 19 Feb 2008) | 8 lines
Account for the fact that the "other" channel can disappear while the local pvt
is not locked.
(fixes a problem introduced in rev 100581)
(closes issue #12012)
Reported by: stevedavies
Patch by me
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@103822 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | channels/chan_local.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c index ae55aaff9..f03f1331b 100644 --- a/channels/chan_local.c +++ b/channels/chan_local.c @@ -179,24 +179,22 @@ static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_fra return 0; } - ast_mutex_unlock(&p->lock); - /* Ensure that we have both channels locked */ - if (us) { - while (ast_channel_trylock(other)) { + while (other && ast_channel_trylock(other)) { + ast_mutex_unlock(&p->lock); + if (us) ast_channel_unlock(us); - usleep(1); + usleep(1); + if (us) ast_channel_lock(us); - } - } else { - ast_channel_lock(other); + ast_mutex_lock(&p->lock); + other = isoutbound ? p->owner : p->chan; } - ast_queue_frame(other, f); - - ast_channel_unlock(other); - - ast_mutex_lock(&p->lock); + if (other) { + ast_queue_frame(other, f); + ast_channel_unlock(other); + } ast_clear_flag(p, LOCAL_GLARE_DETECT); |