aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_local.c
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-04-29 16:17:38 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2010-04-29 16:17:38 +0000
commitd7220bb2461beff8e6b6aa24c8804ac8877a74fd (patch)
treee235935afce6ffa156e00a81f06980a8f29fb18d /channels/chan_local.c
parentd98e4da7c0ca9c6642adadbeb7015f21ad0811ff (diff)
updates blocker fixes for RC
(closes issue 0017052) Reported by: dvossel Tested by: dvossel (closes issue 0016196) Reported by: atis (closes issue 0017052) Reported by: dvossel Tested by: dvossel git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.6.0.27-rc3@260066 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_local.c')
-rw-r--r--channels/chan_local.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 138ded848..11cde5aad 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -540,12 +540,12 @@ static int local_hangup(struct ast_channel *ast)
/* Deadlock avoidance */
while (p->owner && ast_channel_trylock(p->owner)) {
ast_mutex_unlock(&p->lock);
- if (ast) {
- ast_channel_unlock(ast);
+ if (p->chan) {
+ ast_channel_unlock(p->chan);
}
usleep(1);
- if (ast) {
- ast_channel_lock(ast);
+ if (p->chan) {
+ ast_channel_lock(p->chan);
}
ast_mutex_lock(&p->lock);
}
@@ -560,8 +560,17 @@ static int local_hangup(struct ast_channel *ast)
} else {
ast_module_user_remove(p->u_owner);
while (p->chan && ast_channel_trylock(p->chan)) {
- DEADLOCK_AVOIDANCE(&p->lock);
+ ast_mutex_unlock(&p->lock);
+ if (p->owner) {
+ ast_channel_unlock(p->owner);
+ }
+ usleep(1);
+ if (p->owner) {
+ ast_channel_lock(p->owner);
+ }
+ ast_mutex_lock(&p->lock);
}
+
p->owner = NULL;
if (p->chan) {
ast_queue_hangup(p->chan);