]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
stop when we reach the end of our spans
authorMichael Jerris <mike@jerris.com>
Tue, 5 Feb 2008 17:54:15 +0000 (17:54 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 5 Feb 2008 17:54:15 +0000 (17:54 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@388 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/src/zap_io.c

index a88f4f661ed8371d3cdef57d487c289d7c2ab3b6..2987164c69263b287e1c8a7a7141276e8b3d2a56 100644 (file)
@@ -695,11 +695,6 @@ zap_status_t zap_channel_open_any(uint32_t span_id, zap_direction_t direction, z
        }
 
        for(;;) {
-               span = &globals.spans[j];
-               if (!zap_test_flag(span, ZAP_SPAN_CONFIGURED)) {
-                       goto next_loop;
-               }
-
                if (direction == ZAP_TOP_DOWN) {
                        if (j > span_max) {
                                break;
@@ -709,6 +704,11 @@ zap_status_t zap_channel_open_any(uint32_t span_id, zap_direction_t direction, z
                                break;
                        }
                }
+
+               span = &globals.spans[j];
+               if (!zap_test_flag(span, ZAP_SPAN_CONFIGURED)) {
+                       goto next_loop;
+               }
                
                if (direction == ZAP_TOP_DOWN) {
                        i = 1;