FS-10634: [core] Fix switch_channel_wait_for_app_flag from previous commit

This commit is contained in:
Brian West 2019-06-17 11:02:51 -05:00 committed by Andrey Volk
parent d355a57264
commit dab7d83e94
1 changed files with 7 additions and 5 deletions

View File

@ -1752,17 +1752,19 @@ SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_app_flag(switch_channel_
uint32_t app_flag,
const char *key, switch_bool_t pres, uint32_t to)
{
int r = 0;
if (to) {
to++;
}
for (;;) {
if (pres) {
if (switch_channel_test_app_flag_key(key, channel, app_flag)) {
if ((r = switch_channel_test_app_flag_key(key, channel, app_flag))) {
break;
}
} else {
if (!switch_channel_test_app_flag_key(key, channel, app_flag)) {
if (!(r = switch_channel_test_app_flag_key(key, channel, app_flag))) {
break;
}
}
@ -1770,15 +1772,15 @@ SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_app_flag(switch_channel_
switch_cond_next();
if (switch_channel_down(channel)) {
return SWITCH_STATUS_FALSE;
return r;
}
if (to && !--to) {
return SWITCH_STATUS_FALSE;
return r;
}
}
return SWITCH_STATUS_SUCCESS;
return r;
}