git-svn-id: http://svn.openzap.org/svn/openzap/trunk@34 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale 2007-05-18 18:28:32 +00:00
parent bb5824c160
commit 8364a82fe9
2 changed files with 11 additions and 6 deletions

View File

@ -212,15 +212,17 @@ zap_status_t zap_channel_open_any(const char *name, unsigned span_id, zap_direct
j = span_max;
}
for(;;) {
span = &zint->spans[j];
if (!zap_test_flag(span, ZAP_SPAN_CONFIGURED)) {
goto next_loop;
}
if (direction == ZAP_TOP_DOWN) {
if (j == span_max) {
if (j > span_max) {
break;
}
} else {
@ -228,7 +230,7 @@ zap_status_t zap_channel_open_any(const char *name, unsigned span_id, zap_direct
break;
}
}
if (direction == ZAP_TOP_DOWN) {
i = 1;
} else {
@ -238,7 +240,7 @@ zap_status_t zap_channel_open_any(const char *name, unsigned span_id, zap_direct
for(;;) {
if (direction == ZAP_TOP_DOWN) {
if (i == span->chan_count) {
if (i > span->chan_count) {
break;
}
} else {
@ -246,7 +248,7 @@ zap_status_t zap_channel_open_any(const char *name, unsigned span_id, zap_direct
break;
}
}
check = &span->channels[i];
if (zap_test_flag(check, ZAP_CHANNEL_READY) && !zap_test_flag(check, ZAP_CHANNEL_OPEN)) {

View File

@ -15,8 +15,9 @@ int main(int argc, char *argv[])
printf("OpenZAP loaded\n");
if (zap_channel_open("wanpipe", 1, 1, &chan) == ZAP_SUCCESS) {
if (zap_channel_open_any("wanpipe", 0, ZAP_TOP_DOWN, &chan) == ZAP_SUCCESS) {
int x = 0;
printf("opened channel %d:%d\n", chan->span_id, chan->chan_id);
if (zap_channel_command(chan, ZAP_COMMAND_SET_INTERVAL, &ms) == ZAP_SUCCESS) {
ms = 0;
@ -53,6 +54,8 @@ int main(int argc, char *argv[])
printf("wait fail [%s]\n", chan->last_error);
}
}
} else {
printf("open fail [%s]\n", chan->last_error);
}
zap_global_destroy();