]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
avoiding livelock
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 8 Feb 2010 18:18:11 +0000 (18:18 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 8 Feb 2010 18:18:11 +0000 (18:18 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16584 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_ivr.c
src/switch_ivr_bridge.c

index 632987c5324471b5d66626d60ec0367c9a8352e2..3d21777ef8d049683ec5c2f2d3cb75203badd080 100644 (file)
@@ -1275,7 +1275,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
                                switch_channel_set_flag(other_channel, CF_RESET);
                                switch_channel_set_flag(other_channel, CF_REDIRECT);
                                switch_channel_set_state(other_channel, CS_PARK);
-                               switch_channel_wait_for_state(other_channel, channel, CS_PARK);
+                               if (switch_core_session_in_thread(session)) {
+                                       switch_yield(100000);
+                               } else {
+                                       switch_channel_wait_for_state(other_channel, channel, CS_PARK);
+                               }
                                switch_core_session_receive_message(other_session, &msg);
                                switch_channel_wait_for_flag(other_channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
                                switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
@@ -1299,7 +1303,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
                                        switch_ivr_signal_bridge(session, other_session);
                                }
 
-                               switch_channel_wait_for_state(other_channel, channel, CS_HIBERNATE);
+                               if (switch_core_session_in_thread(session)) {
+                    switch_yield(100000);
+                } else {
+                                       switch_channel_wait_for_state(other_channel, channel, CS_HIBERNATE);
+                               }
 
                                if (!switch_core_session_in_thread(session)) {
                                        switch_channel_wait_for_state(channel, other_channel, CS_HIBERNATE);
index a18a940b702edebce42e1cd7ed0e06ee7a0b6ed8..5b6b414584f5333b10e927a2f1bc49003e8981ea 100644 (file)
@@ -347,6 +347,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
                        switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE);
                        bypass_media_after_bridge = 0;
                        switch_channel_clear_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE);
+                       goto end_of_bridge_loop;
                }
 
                /* if 1 channel has DTMF pass it to the other */