add a bunch of locking to mod_iax, if it deadlocks nobody will be suprised part 2

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7992 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-03-31 17:14:49 +00:00
parent 6c83e20b25
commit f1397e4450

View File

@ -1080,16 +1080,18 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
case IAX_EVENT_BUSY:
case IAX_EVENT_HANGUP:
if (channel) {
switch_mutex_lock(globals.mutex);
switch_mutex_lock(tech_pvt->flag_mutex);
switch_clear_flag(tech_pvt, TFLAG_IO);
switch_clear_flag(tech_pvt, TFLAG_VOICE);
switch_mutex_unlock(tech_pvt->flag_mutex);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hangup %s\n", switch_channel_get_name(channel));
switch_set_flag_locked(tech_pvt, TFLAG_HANGUP);
switch_channel_hangup(channel, iaxevent->etype == IAX_EVENT_HANGUP ? SWITCH_CAUSE_NORMAL_CLEARING : SWITCH_CAUSE_FACILITY_REJECTED);
iaxevent->session = NULL;
switch_mutex_unlock(globals.mutex);
}
break;
case IAX_EVENT_CNG: