|
|
@ -1674,14 +1674,10 @@ static void iax2_destroy_helper(struct chan_iax2_pvt *pvt)
|
|
|
|
static int iax2_predestroy(int callno)
|
|
|
|
static int iax2_predestroy(int callno)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
struct ast_channel *c = NULL;
|
|
|
|
struct ast_channel *c = NULL;
|
|
|
|
struct chan_iax2_pvt *pvt = NULL;
|
|
|
|
struct chan_iax2_pvt *pvt = iaxs[callno];
|
|
|
|
|
|
|
|
|
|
|
|
ast_mutex_lock(&iaxsl[callno]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!(pvt = iaxs[callno])) {
|
|
|
|
if (!pvt)
|
|
|
|
ast_mutex_unlock(&iaxsl[callno]);
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!ast_test_flag(pvt, IAX_ALREADYGONE)) {
|
|
|
|
if (!ast_test_flag(pvt, IAX_ALREADYGONE)) {
|
|
|
|
iax2_destroy_helper(pvt);
|
|
|
|
iax2_destroy_helper(pvt);
|
|
|
@ -1697,8 +1693,6 @@ static int iax2_predestroy(int callno)
|
|
|
|
ast_update_use_count();
|
|
|
|
ast_update_use_count();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ast_mutex_unlock(&iaxsl[callno]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1709,7 +1703,6 @@ static void iax2_destroy(int callno)
|
|
|
|
struct ast_channel *owner = NULL;
|
|
|
|
struct ast_channel *owner = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
retry:
|
|
|
|
retry:
|
|
|
|
ast_mutex_lock(&iaxsl[callno]);
|
|
|
|
|
|
|
|
pvt = iaxs[callno];
|
|
|
|
pvt = iaxs[callno];
|
|
|
|
gettimeofday(&lastused[callno], NULL);
|
|
|
|
gettimeofday(&lastused[callno], NULL);
|
|
|
|
|
|
|
|
|
|
|
@ -1720,6 +1713,7 @@ retry:
|
|
|
|
ast_log(LOG_NOTICE, "Avoiding IAX destroy deadlock\n");
|
|
|
|
ast_log(LOG_NOTICE, "Avoiding IAX destroy deadlock\n");
|
|
|
|
ast_mutex_unlock(&iaxsl[callno]);
|
|
|
|
ast_mutex_unlock(&iaxsl[callno]);
|
|
|
|
usleep(1);
|
|
|
|
usleep(1);
|
|
|
|
|
|
|
|
ast_mutex_lock(&iaxsl[callno]);
|
|
|
|
goto retry;
|
|
|
|
goto retry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1764,7 +1758,6 @@ retry:
|
|
|
|
if (owner) {
|
|
|
|
if (owner) {
|
|
|
|
ast_mutex_unlock(&owner->lock);
|
|
|
|
ast_mutex_unlock(&owner->lock);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ast_mutex_unlock(&iaxsl[callno]);
|
|
|
|
|
|
|
|
if (callno & 0x4000)
|
|
|
|
if (callno & 0x4000)
|
|
|
|
update_max_trunk();
|
|
|
|
update_max_trunk();
|
|
|
|
}
|
|
|
|
}
|
|
|
|