From dab7d83e94ed647b4b301ba3b30ca5c1ccc1ebc7 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 17 Jun 2019 11:02:51 -0500 Subject: [PATCH] FS-10634: [core] Fix switch_channel_wait_for_app_flag from previous commit --- src/switch_channel.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 934db1e047..c5c61d43ae 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -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; }