From 4c1f7babadc3292ab5b45a77fe849fbc97c25f23 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 31 Jan 2021 18:24:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_bench_pull.cpp | 6 +++--- tests/test_bench_push.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_bench_pull.cpp b/tests/test_bench_pull.cpp index 872f5527..e2593972 100644 --- a/tests/test_bench_pull.cpp +++ b/tests/test_bench_pull.cpp @@ -167,14 +167,14 @@ int main(int argc, char *argv[]) { //休眠一秒打印 sleep(1); - int alive_player = 0; + size_t alive_player = 0; { lock_guard lck(mtx); alive_player = player_map.size(); } InfoL << "在线播放器个数:" << alive_player; - int re_try = player_count - alive_player; - while (re_try--) { + size_t re_try = player_count - alive_player; + while (!exit_flag && re_try--) { //有些播放器播放失败了,那么我们重试添加 add_player(); } diff --git a/tests/test_bench_push.cpp b/tests/test_bench_push.cpp index 619b5bc8..389e4653 100644 --- a/tests/test_bench_push.cpp +++ b/tests/test_bench_push.cpp @@ -199,14 +199,14 @@ int main(int argc, char *argv[]) { //休眠一秒打印 sleep(1); - int alive_pusher = 0; + size_t alive_pusher = 0; { lock_guard lck(mtx); alive_pusher = pusher_map.size(); } InfoL << "在线推流器个数:" << alive_pusher; auto src = get_src(); - for(auto i = 0; i < pusher_count - alive_pusher && src && !exit_flag; ++i){ + for(size_t i = 0; i < pusher_count - alive_pusher && src && !exit_flag; ++i){ //有些推流器失败了,那么我们重试添加 add_pusher(get_src(), makeRandStr(8), i); }