From 92327f1fe790c93bef9e83c3faa7596c93c934a6 Mon Sep 17 00:00:00 2001 From: levlam Date: Wed, 16 Dec 2020 17:02:09 +0300 Subject: [PATCH] Ignore checkGroupCallIsJoined requests first 10 seconds. --- td/telegram/GroupCallManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/td/telegram/GroupCallManager.cpp b/td/telegram/GroupCallManager.cpp index 9c85db2d6..03c5cbf18 100644 --- a/td/telegram/GroupCallManager.cpp +++ b/td/telegram/GroupCallManager.cpp @@ -414,6 +414,7 @@ struct GroupCallManager::GroupCall { int32 version = -1; int32 duration = 0; int32 source = 0; + int32 joined_date = 0; }; struct GroupCallManager::GroupCallParticipants { @@ -1403,6 +1404,7 @@ bool GroupCallManager::on_join_group_call_response(InputGroupCallId input_group_ auto group_call = get_group_call(input_group_call_id); CHECK(group_call != nullptr); group_call->is_joined = true; + group_call->joined_date = G()->unix_time(); group_call->source = it->second->source; it->second->promise.set_value(result.move_as_ok()); need_update = true; @@ -1548,7 +1550,7 @@ void GroupCallManager::check_group_call_is_joined(GroupCallId group_call_id, Pro if (group_call == nullptr || !group_call->is_inited) { return promise.set_error(Status::Error(400, "GROUP_CALL_JOIN_MISSING")); } - if (!group_call->is_active || !group_call->is_joined) { + if (!group_call->is_active || !group_call->is_joined || group_call->joined_date > G()->unix_time() - 10) { return promise.set_value(Unit()); } auto source = group_call->source; @@ -1624,6 +1626,7 @@ void GroupCallManager::on_group_call_left_impl(GroupCall *group_call) { group_call->is_joined = false; group_call->is_speaking = false; group_call->can_self_unmute = false; + group_call->joined_date = 0; group_call->source = 0; group_call->loaded_all_participants = false; group_call->version = -1;