Prevent race in updating of joined voice chat.
This commit is contained in:
parent
dd4aac2f57
commit
caa1db85ab
@ -677,6 +677,14 @@ bool GroupCallManager::is_group_call_being_joined(InputGroupCallId input_group_c
|
||||
return pending_join_requests_.count(input_group_call_id) != 0;
|
||||
}
|
||||
|
||||
bool GroupCallManager::is_group_call_joined(InputGroupCallId input_group_call_id) const {
|
||||
auto group_call = get_group_call(input_group_call_id);
|
||||
if (group_call == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return group_call->is_joined && !group_call->is_being_left;
|
||||
}
|
||||
|
||||
GroupCallId GroupCallManager::get_group_call_id(InputGroupCallId input_group_call_id, DialogId dialog_id) {
|
||||
if (td_->auth_manager_->is_bot() || !input_group_call_id.is_valid()) {
|
||||
return GroupCallId();
|
||||
|
@ -41,6 +41,8 @@ class GroupCallManager : public Actor {
|
||||
|
||||
bool is_group_call_being_joined(InputGroupCallId input_group_call_id) const;
|
||||
|
||||
bool is_group_call_joined(InputGroupCallId input_group_call_id) const;
|
||||
|
||||
GroupCallId get_group_call_id(InputGroupCallId input_group_call_id, DialogId dialog_id);
|
||||
|
||||
void create_voice_chat(DialogId dialog_id, Promise<GroupCallId> &&promise);
|
||||
|
@ -29722,11 +29722,18 @@ void MessagesManager::on_update_dialog_group_call(DialogId dialog_id, bool has_a
|
||||
if (!has_active_group_call) {
|
||||
is_group_call_empty = false;
|
||||
}
|
||||
if (d->active_group_call_id.is_valid() && has_active_group_call && is_group_call_empty &&
|
||||
(td_->group_call_manager_->is_group_call_being_joined(d->active_group_call_id) ||
|
||||
td_->group_call_manager_->is_group_call_joined(d->active_group_call_id))) {
|
||||
LOG(INFO) << "Fix is_group_call_empty to false";
|
||||
is_group_call_empty = false;
|
||||
}
|
||||
if (d->has_active_group_call == has_active_group_call && d->is_group_call_empty == is_group_call_empty) {
|
||||
return;
|
||||
}
|
||||
if (!force && d->active_group_call_id.is_valid() &&
|
||||
td_->group_call_manager_->is_group_call_being_joined(d->active_group_call_id)) {
|
||||
LOG(INFO) << "Ignore update in a being joined group call";
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user