]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix bug/race in core
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 Feb 2007 20:47:46 +0000 (20:47 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 8 Feb 2007 20:47:46 +0000 (20:47 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4170 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_types.h
src/switch_core.c

index b673f3b692f6cde79285b12914e29fb35d9fe452..6564dc6eb44816f579661500033d37cc98cc3827 100644 (file)
@@ -485,6 +485,8 @@ CF_CONTROLLED       = (1 << 12) - Channel is under control
 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 @@ typedef enum {
        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;
 
 
index 19e8b6debdfc028b7438110fb464a01c559030a0..899389e2aca6b5ac3d350cc1c785ed228beb695c 100644 (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;