[asterisk-commits] file: branch 1.4 r44759 -
/branches/1.4/channels/chan_iax2.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Oct 9 08:41:29 MST 2006
Author: file
Date: Mon Oct 9 10:41:28 2006
New Revision: 44759
URL: http://svn.digium.com/view/asterisk?rev=44759&view=rev
Log:
Properly avoid a collision with iax2_hangup (issue #8115 reported by vazir)
Modified:
branches/1.4/channels/chan_iax2.c
Modified: branches/1.4/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_iax2.c?rev=44759&r1=44758&r2=44759&view=diff
==============================================================================
--- branches/1.4/channels/chan_iax2.c (original)
+++ branches/1.4/channels/chan_iax2.c Mon Oct 9 10:41:28 2006
@@ -1688,13 +1688,10 @@
static int iax2_predestroy(int callno)
{
struct ast_channel *c;
- struct chan_iax2_pvt *pvt;
- ast_mutex_lock(&iaxsl[callno]);
- pvt = iaxs[callno];
- if (!pvt) {
- ast_mutex_unlock(&iaxsl[callno]);
+ struct chan_iax2_pvt *pvt = iaxs[callno];
+
+ if (!pvt)
return -1;
- }
if (!ast_test_flag(pvt, IAX_ALREADYGONE)) {
iax2_destroy_helper(pvt);
ast_set_flag(pvt, IAX_ALREADYGONE);
@@ -1708,19 +1705,16 @@
ast_atomic_fetchadd_int(&usecnt, -1);
ast_update_use_count();
}
- ast_mutex_unlock(&iaxsl[callno]);
return 0;
}
static void iax2_destroy(int callno)
{
- struct chan_iax2_pvt *pvt;
+ struct chan_iax2_pvt *pvt = iaxs[callno];
struct iax_frame *cur;
struct ast_channel *owner;
retry:
- ast_mutex_lock(&iaxsl[callno]);
- pvt = iaxs[callno];
gettimeofday(&lastused[callno], NULL);
owner = pvt ? pvt->owner : NULL;
@@ -1730,6 +1724,7 @@
ast_log(LOG_NOTICE, "Avoiding IAX destroy deadlock\n");
ast_mutex_unlock(&iaxsl[callno]);
usleep(1);
+ ast_mutex_lock(&iaxsl[callno]);
goto retry;
}
}
@@ -1774,7 +1769,6 @@
if (owner) {
ast_mutex_unlock(&owner->lock);
}
- ast_mutex_unlock(&iaxsl[callno]);
if (callno & 0x4000)
update_max_trunk();
}
More information about the asterisk-commits
mailing list