summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2006-10-09 15:49:45 +0000
committerJoshua Colp <jcolp@digium.com>2006-10-09 15:49:45 +0000
commit7b3665596f0f81ad3a525312f080ffa8f6699e64 (patch)
treeca394f29409afa147bcdbd5c0bb89fe3ed270234 /channels
parentd76609521980fd45512dece2fb68e5802f3e21ec (diff)
Merged revisions 44759 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r44759 | file | 2006-10-09 11:41:28 -0400 (Mon, 09 Oct 2006) | 2 lines Properly avoid a collision with iax2_hangup (issue #8115 reported by vazir) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@44762 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_iax2.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 51589392b..3e188f3e9 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -1674,14 +1674,10 @@ static void iax2_destroy_helper(struct chan_iax2_pvt *pvt)
static int iax2_predestroy(int callno)
{
struct ast_channel *c = NULL;
- struct chan_iax2_pvt *pvt = NULL;
-
- ast_mutex_lock(&iaxsl[callno]);
+ struct chan_iax2_pvt *pvt = iaxs[callno];
- if (!(pvt = iaxs[callno])) {
- ast_mutex_unlock(&iaxsl[callno]);
+ if (!pvt)
return -1;
- }
if (!ast_test_flag(pvt, IAX_ALREADYGONE)) {
iax2_destroy_helper(pvt);
@@ -1697,8 +1693,6 @@ static int iax2_predestroy(int callno)
ast_update_use_count();
}
- ast_mutex_unlock(&iaxsl[callno]);
-
return 0;
}
@@ -1709,7 +1703,6 @@ static void iax2_destroy(int callno)
struct ast_channel *owner = NULL;
retry:
- ast_mutex_lock(&iaxsl[callno]);
pvt = iaxs[callno];
gettimeofday(&lastused[callno], NULL);
@@ -1720,6 +1713,7 @@ retry:
ast_log(LOG_NOTICE, "Avoiding IAX destroy deadlock\n");
ast_mutex_unlock(&iaxsl[callno]);
usleep(1);
+ ast_mutex_lock(&iaxsl[callno]);
goto retry;
}
}
@@ -1764,7 +1758,6 @@ retry:
if (owner) {
ast_mutex_unlock(&owner->lock);
}
- ast_mutex_unlock(&iaxsl[callno]);
if (callno & 0x4000)
update_max_trunk();
}