aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-25 19:43:38 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-07-25 19:43:38 +0000
commit3b6f8a1c6342b8d68c88882b29b22468f2803bd8 (patch)
treef2f5807a309f47df9df12093a0b44e55faa4fac0 /channels/chan_zap.c
parent27037bc2df250a77422521b7740a184ef2709024 (diff)
This resolves a deadlock that a tech support customer was getting frequently
when his users would answer call waiting. If another thread is currently holding the zt_pvt lock for the first channel, unlock both channels and let asterisk retry the native bridge, just like what is done for the second channel directly below these changes. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@38200 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-rw-r--r--channels/chan_zap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 8f69f886f..2cd028a01 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -3047,7 +3047,13 @@ static enum ast_bridge_result zt_bridge(struct ast_channel *c0, struct ast_chann
oc0 = p0->owner;
oc1 = p1->owner;
- ast_mutex_lock(&p0->lock);
+ if (ast_mutex_trylock(&p0->lock)) {
+ /* Don't block, due to potential for deadlock */
+ ast_mutex_unlock(&c0->lock);
+ ast_mutex_unlock(&c1->lock);
+ ast_log(LOG_NOTICE, "Avoiding deadlock...\n");
+ return AST_BRIDGE_RETRY;
+ }
if (ast_mutex_trylock(&p1->lock)) {
/* Don't block, due to potential for deadlock */
ast_mutex_unlock(&p0->lock);