fix bug/race in core

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4170 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-02-08 20:47:46 +00:00
parent 58310a9272
commit 5327a156ee
2 changed files with 11 additions and 2 deletions
+7 -1
View File
@@ -3014,6 +3014,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
const switch_endpoint_interface_t *endpoint_interface;
const switch_state_handler_table_t *driver_state_handler = NULL;
const switch_state_handler_table_t *application_state_handler = NULL;
#ifdef CRASH_PROT
switch_thread_id_t thread_id = switch_thread_self();
jmp_buf env;
@@ -3065,7 +3066,12 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session)
switch_mutex_lock(session->mutex);
while ((state = switch_channel_get_state(session->channel)) != CS_DONE) {
if (state != laststate) {
uint8_t exception = 0;
if (switch_channel_test_flag(session->channel, CF_REPEAT_STATE)) {
switch_channel_clear_flag(session->channel, CF_REPEAT_STATE);
exception = 1;
}
if (state != laststate || state == CS_HANGUP || exception) {
int index = 0;
int proceed = 1;
midstate = state;