aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_local.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-12-02 15:52:37 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-12-02 15:52:37 +0000
commitbfdfae9365e11bf6ede3709e91882148e26ebc21 (patch)
treee204e1077f6c349e9df770147594b59a27bf5d02 /channels/chan_local.c
parent687e9278cba21dd1c2cd956512d2c5c493e289b9 (diff)
Really fix chan local races (I hope)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1813 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rwxr-xr-xchannels/chan_local.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 8cc057b81..1e11c7b50 100755
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -74,15 +74,15 @@ static struct local_pvt {
static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us)
{
struct ast_channel *other;
+retrylock:
+ /* Recalculate outbound channel */
if (isoutbound) {
other = p->owner;
} else {
other = p->chan;
}
- if (!other)
- return 0;
+ /* Set glare detection */
p->glaredetect = 1;
-retrylock:
if (p->cancelqueue) {
/* We had a glare on the hangup. Forget all this business,
return and destroy p. */
@@ -90,6 +90,10 @@ retrylock:
free(p);
return -1;
}
+ if (!other) {
+ p->glaredetect = 0;
+ return 0;
+ }
if (ast_mutex_trylock(&other->lock)) {
/* Failed to lock. Release main lock and try again */
ast_mutex_unlock(&p->lock);