]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cleanup testing analog
authorAnthony Minessale <anthony.minessale@gmail.com>
Sun, 17 Jun 2007 05:31:28 +0000 (05:31 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Sun, 17 Jun 2007 05:31:28 +0000 (05:31 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@269 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/zap_io.c

index 22bd482a9bd331445910d3c7c531bec1674741d0..019592ad99c6c9b81dc0bfe8a559b0cf05871dac 100644 (file)
@@ -522,6 +522,7 @@ zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t sta
                        ok = 0;
                        switch(state) {
                        case ZAP_CHANNEL_STATE_DOWN:
+                       case ZAP_CHANNEL_STATE_BUSY:
                                ok = 1;
                                break;
                        default:
@@ -716,8 +717,10 @@ static zap_status_t zap_channel_reset(zap_channel_t *zchan)
 zap_status_t zap_channel_open_chan(zap_channel_t *zchan)
 {
        zap_status_t status = ZAP_FAIL;
-       
-       if ((status = zap_mutex_trylock(zchan->mutex)) != ZAP_SUCCESS) {
+
+       assert(zchan != NULL);
+
+       if (!zap_test_flag(zchan, ZAP_CHANNEL_READY) || (status = zap_mutex_trylock(zchan->mutex)) != ZAP_SUCCESS) {
                return status;
        }
 
@@ -745,7 +748,7 @@ zap_status_t zap_channel_open(uint32_t span_id, uint32_t chan_id, zap_channel_t
 
                check = &globals.spans[span_id].channels[chan_id];
 
-               if ((status = zap_mutex_trylock(check->mutex)) != ZAP_SUCCESS) {
+               if (!zap_test_flag(check, ZAP_CHANNEL_READY) || (status = zap_mutex_trylock(check->mutex)) != ZAP_SUCCESS) {
                        goto done;
                }