完善代码

This commit is contained in:
xiongziliang 2021-01-31 18:24:41 +08:00
parent 0f39565f67
commit 4c1f7babad
2 changed files with 5 additions and 5 deletions

View File

@ -167,14 +167,14 @@ int main(int argc, char *argv[]) {
//休眠一秒打印 //休眠一秒打印
sleep(1); sleep(1);
int alive_player = 0; size_t alive_player = 0;
{ {
lock_guard<recursive_mutex> lck(mtx); lock_guard<recursive_mutex> lck(mtx);
alive_player = player_map.size(); alive_player = player_map.size();
} }
InfoL << "在线播放器个数:" << alive_player; InfoL << "在线播放器个数:" << alive_player;
int re_try = player_count - alive_player; size_t re_try = player_count - alive_player;
while (re_try--) { while (!exit_flag && re_try--) {
//有些播放器播放失败了,那么我们重试添加 //有些播放器播放失败了,那么我们重试添加
add_player(); add_player();
} }

View File

@ -199,14 +199,14 @@ int main(int argc, char *argv[]) {
//休眠一秒打印 //休眠一秒打印
sleep(1); sleep(1);
int alive_pusher = 0; size_t alive_pusher = 0;
{ {
lock_guard<recursive_mutex> lck(mtx); lock_guard<recursive_mutex> lck(mtx);
alive_pusher = pusher_map.size(); alive_pusher = pusher_map.size();
} }
InfoL << "在线推流器个数:" << alive_pusher; InfoL << "在线推流器个数:" << alive_pusher;
auto src = get_src(); 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); add_pusher(get_src(), makeRandStr(8), i);
} }