[Freeswitch-svn] [commit] r4170 - in freeswitch/trunk/src: . include

Freeswitch SVN anthm at freeswitch.org
Thu Feb 8 15:47:46 EST 2007


Author: anthm
Date: Thu Feb  8 15:47:46 2007
New Revision: 4170

Modified:
   freeswitch/trunk/src/include/switch_types.h
   freeswitch/trunk/src/switch_core.c

Log:
fix bug/race in core

Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h	(original)
+++ freeswitch/trunk/src/include/switch_types.h	Thu Feb  8 15:47:46 2007
@@ -485,6 +485,8 @@
 CF_NOMEDIA		= (1 << 13) - Channel has no media
 CF_SUSPEND		= (1 << 14) - Suspend i/o
 CF_EVENT_PARSE  = (1 << 15) - Suspend control events
+CF_NO_INDICATE  = (1 << 16) - Disable Indications
+CF_REPEAT_STATE = (1 << 17) - Tell the state machine to repeat a state
 </pre>
  */
 
@@ -505,7 +507,8 @@
 	CF_NOMEDIA		= (1 << 13),
 	CF_SUSPEND		= (1 << 14),
 	CF_EVENT_PARSE	= (1 << 15),
-	CF_NO_INDICATE	= (1 << 16)
+	CF_NO_INDICATE	= (1 << 16),
+    CF_REPEAT_STATE = (1 << 17)
 } switch_channel_flag_t;
 
 

Modified: freeswitch/trunk/src/switch_core.c
==============================================================================
--- freeswitch/trunk/src/switch_core.c	(original)
+++ freeswitch/trunk/src/switch_core.c	Thu Feb  8 15:47:46 2007
@@ -3014,6 +3014,7 @@
 	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_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;



More information about the Freeswitch-svn mailing list