Add more close_flag checks.

This commit is contained in:
levlam 2022-01-13 17:28:10 +03:00
parent 7458a0fc15
commit 7974571615
3 changed files with 28 additions and 0 deletions

View File

@ -11829,6 +11829,9 @@ void MessagesManager::repair_server_dialog_total_count(DialogListId dialog_list_
// can repair total count only in folders
return;
}
if (G()->close_flag()) {
return;
}
LOG(INFO) << "Repair total chat count in " << dialog_list_id;
send_closure(td_->create_net_actor<GetDialogListActor>(Promise<Unit>()), &GetDialogListActor::send,
@ -24779,6 +24782,9 @@ void MessagesManager::on_message_media_uploaded(DialogId dialog_id, const Messag
FileId thumbnail_file_id) {
CHECK(m != nullptr);
CHECK(input_media != nullptr);
if (G()->close_flag()) {
return;
}
auto message_id = m->message_id;
if (message_id.is_any_server()) {
@ -24862,6 +24868,9 @@ void MessagesManager::on_secret_message_media_uploaded(DialogId dialog_id, const
CHECK(m != nullptr);
CHECK(m->message_id.is_valid());
CHECK(!secret_input_media.empty());
if (G()->close_flag()) {
return;
}
/*
if (m->media_album_id != 0) {
switch (secret_input_media->input_file_->get_id()) {
@ -25065,6 +25074,10 @@ void MessagesManager::do_send_message_group(int64 media_album_id) {
// the group may be already sent or failed to be sent
return;
}
if (G()->close_flag()) {
return;
}
auto &request = it->second;
auto dialog_id = request.dialog_id;
@ -25168,6 +25181,9 @@ void MessagesManager::on_text_message_ready_to_send(DialogId dialog_id, MessageI
if (m == nullptr) {
return;
}
if (G()->close_flag()) {
return;
}
CHECK(message_id.is_yet_unsent());
@ -26973,6 +26989,9 @@ void MessagesManager::do_forward_messages(DialogId to_dialog_id, DialogId from_d
if (messages.empty()) {
return;
}
if (G()->close_flag()) {
return;
}
if (log_event_id == 0 && G()->parameters().use_message_db) {
log_event_id = save_forward_messages_log_event(to_dialog_id, from_dialog_id, messages, message_ids);
@ -37661,6 +37680,9 @@ MessagesManager::Message *MessagesManager::continue_send_message(DialogId dialog
}
void MessagesManager::on_binlog_events(vector<BinlogEvent> &&events) {
if (G()->close_flag()) {
return;
}
for (auto &event : events) {
CHECK(event.id_ != 0);
switch (event.type_) {

View File

@ -4095,6 +4095,9 @@ void NotificationManager::try_send_update_active_notifications() {
}
void NotificationManager::on_binlog_events(vector<BinlogEvent> &&events) {
if (G()->close_flag()) {
return;
}
VLOG(notifications) << "Begin to process " << events.size() << " binlog events";
for (auto &event : events) {
if (!G()->parameters().use_message_db || is_disabled() || max_notification_group_count_ == 0) {

View File

@ -1676,6 +1676,9 @@ void PollManager::on_get_poll_vote(PollId poll_id, UserId user_id, vector<Buffer
}
void PollManager::on_binlog_events(vector<BinlogEvent> &&events) {
if (G()->close_flag()) {
return;
}
for (auto &event : events) {
switch (event.type_) {
case LogEvent::HandlerType::SetPollAnswer: {