]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freetdm: remove hack for race condition since the root cause was fixed
authorMoises Silva <moy@sangoma.com>
Tue, 31 Aug 2010 18:23:37 +0000 (14:23 -0400)
committerMoises Silva <moy@sangoma.com>
Tue, 31 Aug 2010 18:23:37 +0000 (14:23 -0400)
libs/freetdm/src/ftdm_io.c

index 223eb340b8ba5a560facc09e244e498dfccd5acb..56fe77d131064907c591bcb826ef027c9cac40f5 100644 (file)
@@ -1972,24 +1972,12 @@ done:
 /* lock must be acquired by the caller! */
 static ftdm_status_t call_hangup(ftdm_channel_t *chan, const char *file, const char *func, int line)
 {
+       ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP);
        if (chan->state != FTDM_CHANNEL_STATE_DOWN) {
                if (chan->state == FTDM_CHANNEL_STATE_HANGUP) {
                        /* make user's life easier, and just ignore double hangup requests */
                        return FTDM_SUCCESS;
                }
-               if (chan->state == FTDM_CHANNEL_STATE_TERMINATING && ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) {
-                       /* the signaling stack is already terminating the call but has not yet notified the user about it 
-                        * with SIGEVENT_STOP, we must flag this channel as hangup and wait for the SIGEVENT_STOP before
-                        * proceeding, at that point we will move the channel to hangup, but the SIGEVENT_STOP will not
-                        * be sent to the user since they already made clear they want to hangup!
-                        * */
-                       ftdm_set_flag(chan, FTDM_CHANNEL_USER_HANGUP);
-                       ftdm_wait_for_flag_cleared(chan, FTDM_CHANNEL_STATE_CHANGE, 5000);
-                       if (ftdm_test_flag(chan, FTDM_CHANNEL_STATE_CHANGE)) {
-                               ftdm_log_chan(chan, FTDM_LOG_CRIT, "Failed to hangup, state change for %d/%s is still pending!\n", chan->state, ftdm_channel_state2str(chan->state));
-                               return FTDM_FAIL;
-                       }
-               }
                ftdm_channel_set_state(file, func, line, chan, FTDM_CHANNEL_STATE_HANGUP, 1);
        } else {
                /* the signaling stack did not touch the state,