Add Global::request_aborted_error.
This commit is contained in:
parent
3b794126d8
commit
328c5b57d2
@ -698,9 +698,7 @@ void AnimationsManager::add_saved_animation(const tl_object_ptr<td_api::InputFil
|
||||
}
|
||||
|
||||
void AnimationsManager::send_save_gif_query(FileId animation_id, bool unsave, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
// TODO invokeAfter and log event
|
||||
auto file_view = td_->file_manager_->get_file_view(animation_id);
|
||||
|
@ -472,9 +472,8 @@ Result<string> BackgroundManager::get_background_url(const string &name,
|
||||
void BackgroundManager::reload_background_from_server(
|
||||
BackgroundId background_id, const string &background_name,
|
||||
telegram_api::object_ptr<telegram_api::InputWallPaper> &&input_wallpaper, Promise<Unit> &&promise) const {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
td_->create_handler<GetBackgroundQuery>(std::move(promise))
|
||||
->send(background_id, background_name, std::move(input_wallpaper));
|
||||
}
|
||||
|
@ -840,7 +840,7 @@ void CallActor::send_with_promise(NetQueryPtr query, Promise<NetQueryPtr> promis
|
||||
|
||||
void CallActor::hangup() {
|
||||
container_.for_each(
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Status::Error(500, "Request aborted")); });
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Global::request_aborted_error()); });
|
||||
stop();
|
||||
}
|
||||
|
||||
|
@ -274,9 +274,7 @@ void CallbackQueriesManager::send_get_callback_answer_query(
|
||||
FullMessageId full_message_id, tl_object_ptr<td_api::CallbackQueryPayload> &&payload,
|
||||
tl_object_ptr<telegram_api::InputCheckPasswordSRP> &&password,
|
||||
Promise<td_api::object_ptr<td_api::callbackQueryAnswer>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
|
@ -956,9 +956,7 @@ void ConfigManager::lazy_request_config() {
|
||||
}
|
||||
|
||||
void ConfigManager::get_app_config(Promise<td_api::object_ptr<td_api::JsonValue>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto auth_manager = G()->td().get_actor_unsafe()->auth_manager_.get();
|
||||
if (auth_manager != nullptr && auth_manager->is_bot()) {
|
||||
@ -974,9 +972,7 @@ void ConfigManager::get_app_config(Promise<td_api::object_ptr<td_api::JsonValue>
|
||||
}
|
||||
|
||||
void ConfigManager::get_content_settings(Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto auth_manager = G()->td().get_actor_unsafe()->auth_manager_.get();
|
||||
if (auth_manager == nullptr || !auth_manager->is_authorized() || auth_manager->is_bot()) {
|
||||
@ -991,9 +987,7 @@ void ConfigManager::get_content_settings(Promise<Unit> &&promise) {
|
||||
}
|
||||
|
||||
void ConfigManager::set_content_settings(bool ignore_sensitive_content_restrictions, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
last_set_content_settings_ = ignore_sensitive_content_restrictions;
|
||||
auto &queries = set_content_settings_queries_[ignore_sensitive_content_restrictions];
|
||||
@ -1011,9 +1005,7 @@ void ConfigManager::set_content_settings(bool ignore_sensitive_content_restricti
|
||||
}
|
||||
|
||||
void ConfigManager::get_global_privacy_settings(Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto auth_manager = G()->td().get_actor_unsafe()->auth_manager_.get();
|
||||
if (auth_manager == nullptr || !auth_manager->is_authorized() || auth_manager->is_bot()) {
|
||||
@ -1028,9 +1020,8 @@ void ConfigManager::get_global_privacy_settings(Promise<Unit> &&promise) {
|
||||
}
|
||||
|
||||
void ConfigManager::set_archive_and_mute(bool archive_and_mute, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
if (archive_and_mute) {
|
||||
remove_suggested_action(suggested_actions_, SuggestedAction{SuggestedAction::Type::EnableArchiveAndMuteNewChats});
|
||||
}
|
||||
|
@ -1184,13 +1184,11 @@ class TogglePrehistoryHiddenQuery final : public Td::ResultHandler {
|
||||
|
||||
td->updates_manager_->on_get_updates(
|
||||
std::move(ptr),
|
||||
PromiseCreator::lambda([promise = std::move(promise_), channel_id = channel_id_,
|
||||
PromiseCreator::lambda([actor_id = G()->contacts_manager(), promise = std::move(promise_),
|
||||
channel_id = channel_id_,
|
||||
is_all_history_available = is_all_history_available_](Unit result) mutable {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
send_closure(G()->contacts_manager(), &ContactsManager::on_update_channel_is_all_history_available,
|
||||
channel_id, is_all_history_available, std::move(promise));
|
||||
send_closure(actor_id, &ContactsManager::on_update_channel_is_all_history_available, channel_id,
|
||||
is_all_history_available, std::move(promise));
|
||||
}));
|
||||
}
|
||||
|
||||
@ -1416,13 +1414,11 @@ class ToggleSlowModeQuery final : public Td::ResultHandler {
|
||||
LOG(INFO) << "Receive result for ToggleSlowModeQuery: " << to_string(ptr);
|
||||
|
||||
td->updates_manager_->on_get_updates(
|
||||
std::move(ptr), PromiseCreator::lambda([promise = std::move(promise_), channel_id = channel_id_,
|
||||
slow_mode_delay = slow_mode_delay_](Unit result) mutable {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
send_closure(G()->contacts_manager(), &ContactsManager::on_update_channel_slow_mode_delay, channel_id,
|
||||
slow_mode_delay, std::move(promise));
|
||||
std::move(ptr),
|
||||
PromiseCreator::lambda([actor_id = G()->contacts_manager(), promise = std::move(promise_),
|
||||
channel_id = channel_id_, slow_mode_delay = slow_mode_delay_](Unit result) mutable {
|
||||
send_closure(actor_id, &ContactsManager::on_update_channel_slow_mode_delay, channel_id, slow_mode_delay,
|
||||
std::move(promise));
|
||||
}));
|
||||
}
|
||||
|
||||
@ -5326,9 +5322,7 @@ void ContactsManager::reload_contacts(bool force) {
|
||||
}
|
||||
|
||||
void ContactsManager::add_contact(Contact contact, bool share_phone_number, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
if (!are_contacts_loaded_) {
|
||||
load_contacts(PromiseCreator::lambda([actor_id = actor_id(this), contact = std::move(contact), share_phone_number,
|
||||
@ -5729,9 +5723,7 @@ std::pair<int32, vector<UserId>> ContactsManager::search_contacts(const string &
|
||||
}
|
||||
|
||||
void ContactsManager::share_phone_number(UserId user_id, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
if (!are_contacts_loaded_) {
|
||||
load_contacts(PromiseCreator::lambda(
|
||||
@ -6584,9 +6576,7 @@ void ContactsManager::get_channel_statistics_dc_id(DialogId dialog_id, bool for_
|
||||
|
||||
void ContactsManager::get_channel_statistics_dc_id_impl(ChannelId channel_id, bool for_full_statistics,
|
||||
Promise<DcId> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto channel_full = get_channel_full(channel_id, false, "get_channel_statistics_dc_id_impl");
|
||||
if (channel_full == nullptr) {
|
||||
@ -6615,9 +6605,8 @@ void ContactsManager::get_channel_statistics(DialogId dialog_id, bool is_dark,
|
||||
|
||||
void ContactsManager::send_get_channel_stats_query(DcId dc_id, ChannelId channel_id, bool is_dark,
|
||||
Promise<td_api::object_ptr<td_api::ChatStatistics>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
const Channel *c = get_channel(channel_id);
|
||||
CHECK(c != nullptr);
|
||||
if (c->is_megagroup) {
|
||||
@ -6666,9 +6655,7 @@ void ContactsManager::get_channel_message_statistics(FullMessageId full_message_
|
||||
void ContactsManager::send_get_channel_message_stats_query(
|
||||
DcId dc_id, FullMessageId full_message_id, bool is_dark,
|
||||
Promise<td_api::object_ptr<td_api::messageStatistics>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto dialog_id = full_message_id.get_dialog_id();
|
||||
if (!td_->messages_manager_->have_message_force(full_message_id, "send_get_channel_message_stats_query")) {
|
||||
@ -6697,9 +6684,7 @@ void ContactsManager::load_statistics_graph(DialogId dialog_id, const string &to
|
||||
|
||||
void ContactsManager::send_load_async_graph_query(DcId dc_id, string token, int64 x,
|
||||
Promise<td_api::object_ptr<td_api::StatisticalGraph>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
td_->create_handler<LoadAsyncGraphQuery>(std::move(promise))->send(token, x, dc_id);
|
||||
}
|
||||
@ -7218,9 +7203,7 @@ void ContactsManager::transfer_dialog_ownership(DialogId dialog_id, UserId user_
|
||||
void ContactsManager::transfer_channel_ownership(
|
||||
ChannelId channel_id, UserId user_id, tl_object_ptr<telegram_api::InputCheckPasswordSRP> input_check_password,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
td_->create_handler<EditChannelCreatorQuery>(std::move(promise))
|
||||
->send(channel_id, user_id, std::move(input_check_password));
|
||||
@ -7285,10 +7268,7 @@ void ContactsManager::export_dialog_invite_link(DialogId dialog_id, int32 expire
|
||||
void ContactsManager::export_dialog_invite_link_impl(DialogId dialog_id, int32 expire_date, int32 usage_limit,
|
||||
bool is_permanent,
|
||||
Promise<td_api::object_ptr<td_api::chatInviteLink>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_STATUS_PROMISE(promise, can_manage_dialog_invite_links(dialog_id));
|
||||
|
||||
td_->create_handler<ExportChatInviteQuery>(std::move(promise))
|
||||
@ -7479,9 +7459,7 @@ void ContactsManager::delete_chat_participant(ChatId chat_id, UserId user_id, bo
|
||||
void ContactsManager::restrict_channel_participant(ChannelId channel_id, DialogId participant_dialog_id,
|
||||
DialogParticipantStatus status, DialogParticipantStatus old_status,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
LOG(INFO) << "Restrict " << participant_dialog_id << " in " << channel_id << " from " << old_status << " to "
|
||||
<< status;
|
||||
@ -11689,9 +11667,7 @@ void ContactsManager::on_get_channel_participants(
|
||||
ChannelId channel_id, ChannelParticipantsFilter filter, int32 offset, int32 limit, string additional_query,
|
||||
int32 additional_limit, tl_object_ptr<telegram_api::channels_channelParticipants> &&channel_participants,
|
||||
Promise<DialogParticipants> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
on_get_users(std::move(channel_participants->users_), "on_get_channel_participants");
|
||||
on_get_chats(std::move(channel_participants->chats_), "on_get_channel_participants");
|
||||
@ -13319,9 +13295,8 @@ void ContactsManager::on_update_channel_location(ChannelId channel_id, const Dia
|
||||
|
||||
void ContactsManager::on_update_channel_slow_mode_delay(ChannelId channel_id, int32 slow_mode_delay,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto channel_full = get_channel_full_force(channel_id, true, "on_update_channel_slow_mode_delay");
|
||||
if (channel_full != nullptr) {
|
||||
on_update_channel_full_slow_mode_delay(channel_full, channel_id, slow_mode_delay, 0);
|
||||
@ -13368,9 +13343,7 @@ void ContactsManager::on_update_channel_full_bot_user_ids(ChannelFull *channel_f
|
||||
|
||||
void ContactsManager::on_update_channel_is_all_history_available(ChannelId channel_id, bool is_all_history_available,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
CHECK(channel_id.is_valid());
|
||||
auto channel_full = get_channel_full_force(channel_id, true, "on_update_channel_is_all_history_available");
|
||||
if (channel_full != nullptr && channel_full->is_all_history_available != is_all_history_available) {
|
||||
@ -14754,9 +14727,7 @@ void ContactsManager::get_dialog_participant(DialogId dialog_id,
|
||||
|
||||
void ContactsManager::finish_get_dialog_participant(DialogParticipant &&dialog_participant,
|
||||
Promise<td_api::object_ptr<td_api::chatMember>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto participant_dialog_id = dialog_participant.dialog_id;
|
||||
bool is_user = participant_dialog_id.get_type() == DialogType::User;
|
||||
@ -14967,9 +14938,7 @@ void ContactsManager::get_chat_participant(ChatId chat_id, UserId user_id, Promi
|
||||
|
||||
void ContactsManager::finish_get_chat_participant(ChatId chat_id, UserId user_id,
|
||||
Promise<DialogParticipant> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
const auto *participant = get_chat_participant(chat_id, user_id);
|
||||
if (participant == nullptr) {
|
||||
@ -15000,9 +14969,7 @@ void ContactsManager::search_chat_participants(ChatId chat_id, const string &que
|
||||
void ContactsManager::do_search_chat_participants(ChatId chat_id, const string &query, int32 limit,
|
||||
DialogParticipantsFilter filter,
|
||||
Promise<DialogParticipants> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto chat_full = get_chat_full(chat_id);
|
||||
if (chat_full == nullptr) {
|
||||
@ -15075,9 +15042,7 @@ void ContactsManager::get_channel_participant(ChannelId channel_id, DialogId par
|
||||
|
||||
void ContactsManager::finish_get_channel_participant(ChannelId channel_id, DialogParticipant &&dialog_participant,
|
||||
Promise<DialogParticipant> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
LOG(INFO) << "Receive a member " << dialog_participant.dialog_id << " of a channel " << channel_id;
|
||||
|
||||
|
@ -59,7 +59,7 @@ void DelayDispatcher::tear_down() {
|
||||
while (!queue_.empty()) {
|
||||
auto query = std::move(queue_.front());
|
||||
queue_.pop();
|
||||
query.net_query->set_error(Status::Error(500, "Request aborted"));
|
||||
query.net_query->set_error(Global::request_aborted_error());
|
||||
send_closure(std::move(query.callback), &NetQueryCallback::on_result, std::move(query.net_query));
|
||||
}
|
||||
parent_.reset();
|
||||
|
@ -375,6 +375,10 @@ class Global final : public ActorContext {
|
||||
#endif
|
||||
}
|
||||
|
||||
static Status request_aborted_error() {
|
||||
return Status::Error(500, "Request aborted");
|
||||
}
|
||||
|
||||
void set_close_flag() {
|
||||
close_flag_ = true;
|
||||
}
|
||||
@ -382,6 +386,10 @@ class Global final : public ActorContext {
|
||||
return close_flag_.load();
|
||||
}
|
||||
|
||||
Status close_status() const {
|
||||
return close_flag() ? request_aborted_error() : Status::OK();
|
||||
}
|
||||
|
||||
bool is_expected_error(const Status &error) const {
|
||||
CHECK(error.is_error());
|
||||
if (error.code() == 401) {
|
||||
|
@ -1310,9 +1310,7 @@ void GroupCallManager::create_voice_chat(DialogId dialog_id, string title, int32
|
||||
|
||||
void GroupCallManager::on_voice_chat_created(DialogId dialog_id, InputGroupCallId input_group_call_id,
|
||||
Promise<GroupCallId> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
if (!input_group_call_id.is_valid()) {
|
||||
return promise.set_error(Status::Error(500, "Receive invalid group call identifier"));
|
||||
}
|
||||
@ -1389,7 +1387,7 @@ void GroupCallManager::finish_get_group_call(InputGroupCallId input_group_call_i
|
||||
load_group_call_queries_.erase(it);
|
||||
|
||||
if (G()->close_flag()) {
|
||||
result = Status::Error(500, "Request aborted");
|
||||
result = Global::request_aborted_error();
|
||||
}
|
||||
|
||||
if (result.is_ok()) {
|
||||
@ -2336,10 +2334,7 @@ void GroupCallManager::get_group_call_stream_segment(GroupCallId group_call_id,
|
||||
int32 channel_id,
|
||||
td_api::object_ptr<td_api::GroupCallVideoQuality> quality,
|
||||
Promise<string> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -2426,10 +2421,7 @@ void GroupCallManager::finish_get_group_call_stream_segment(InputGroupCallId inp
|
||||
}
|
||||
|
||||
void GroupCallManager::start_scheduled_group_call(GroupCallId group_call_id, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -2837,10 +2829,7 @@ void GroupCallManager::process_group_call_after_join_requests(InputGroupCallId i
|
||||
}
|
||||
|
||||
void GroupCallManager::set_group_call_title(GroupCallId group_call_id, string title, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -2914,10 +2903,7 @@ void GroupCallManager::on_edit_group_call_title(InputGroupCallId input_group_cal
|
||||
|
||||
void GroupCallManager::toggle_group_call_is_my_video_paused(GroupCallId group_call_id, bool is_my_video_paused,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -3002,10 +2988,7 @@ void GroupCallManager::on_toggle_group_call_is_my_video_paused(InputGroupCallId
|
||||
|
||||
void GroupCallManager::toggle_group_call_is_my_video_enabled(GroupCallId group_call_id, bool is_my_video_enabled,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -3093,10 +3076,7 @@ void GroupCallManager::on_toggle_group_call_is_my_video_enabled(InputGroupCallId
|
||||
void GroupCallManager::toggle_group_call_is_my_presentation_paused(GroupCallId group_call_id,
|
||||
bool is_my_presentation_paused,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -3184,10 +3164,7 @@ void GroupCallManager::on_toggle_group_call_is_my_presentation_paused(InputGroup
|
||||
|
||||
void GroupCallManager::toggle_group_call_start_subscribed(GroupCallId group_call_id, bool start_subscribed,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -3271,10 +3248,7 @@ void GroupCallManager::on_toggle_group_call_start_subscription(InputGroupCallId
|
||||
|
||||
void GroupCallManager::toggle_group_call_mute_new_participants(GroupCallId group_call_id, bool mute_new_participants,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -3361,10 +3335,7 @@ void GroupCallManager::on_toggle_group_call_mute_new_participants(InputGroupCall
|
||||
}
|
||||
|
||||
void GroupCallManager::revoke_group_call_invite_link(GroupCallId group_call_id, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -3417,10 +3388,7 @@ void GroupCallManager::invite_group_call_participants(GroupCallId group_call_id,
|
||||
|
||||
void GroupCallManager::get_group_call_invite_link(GroupCallId group_call_id, bool can_self_unmute,
|
||||
Promise<string> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -3452,10 +3420,7 @@ void GroupCallManager::get_group_call_invite_link(GroupCallId group_call_id, boo
|
||||
void GroupCallManager::toggle_group_call_recording(GroupCallId group_call_id, bool is_enabled, string title,
|
||||
bool record_video, bool use_portrait_orientation,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -3545,10 +3510,7 @@ void GroupCallManager::on_toggle_group_call_recording(InputGroupCallId input_gro
|
||||
|
||||
void GroupCallManager::set_group_call_participant_is_speaking(GroupCallId group_call_id, int32 audio_source,
|
||||
bool is_speaking, Promise<Unit> &&promise, int32 date) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_RESULT_PROMISE(promise, input_group_call_id, get_input_group_call_id(group_call_id));
|
||||
|
||||
auto *group_call = get_group_call(input_group_call_id);
|
||||
@ -3594,9 +3556,6 @@ void GroupCallManager::set_group_call_participant_is_speaking(GroupCallId group_
|
||||
if (!is_recursive) {
|
||||
auto query_promise = PromiseCreator::lambda([actor_id = actor_id(this), group_call_id, audio_source, is_speaking,
|
||||
promise = std::move(promise), date](Result<Unit> &&result) mutable {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
if (result.is_error()) {
|
||||
promise.set_value(Unit());
|
||||
} else {
|
||||
|
@ -1873,7 +1873,7 @@ void LanguagePackManager::send_with_promise(NetQueryPtr query, Promise<NetQueryP
|
||||
|
||||
void LanguagePackManager::hangup() {
|
||||
container_.for_each(
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Status::Error(500, "Request aborted")); });
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Global::request_aborted_error()); });
|
||||
stop();
|
||||
}
|
||||
|
||||
|
@ -9218,9 +9218,7 @@ void MessagesManager::get_channel_differences_if_needed(MessagesInfo &&messages_
|
||||
|
||||
void MessagesManager::on_get_messages(vector<tl_object_ptr<telegram_api::Message>> &&messages, bool is_channel_message,
|
||||
bool is_scheduled, Promise<Unit> &&promise, const char *source) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
LOG(DEBUG) << "Receive " << messages.size() << " messages";
|
||||
for (auto &message : messages) {
|
||||
@ -9232,9 +9230,7 @@ void MessagesManager::on_get_messages(vector<tl_object_ptr<telegram_api::Message
|
||||
void MessagesManager::on_get_history(DialogId dialog_id, MessageId from_message_id, MessageId old_last_new_message_id,
|
||||
int32 offset, int32 limit, bool from_the_end,
|
||||
vector<tl_object_ptr<telegram_api::Message>> &&messages, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
LOG(INFO) << "Receive " << messages.size() << " history messages " << (from_the_end ? "from the end " : "") << "in "
|
||||
<< dialog_id << " from " << from_message_id << " with offset " << offset << " and limit " << limit;
|
||||
@ -9584,9 +9580,7 @@ void MessagesManager::on_get_dialog_messages_search_result(
|
||||
DialogId dialog_id, const string &query, DialogId sender_dialog_id, MessageId from_message_id, int32 offset,
|
||||
int32 limit, MessageSearchFilter filter, MessageId top_thread_message_id, int64 random_id, int32 total_count,
|
||||
vector<tl_object_ptr<telegram_api::Message>> &&messages, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
LOG(INFO) << "Receive " << messages.size() << " found messages in " << dialog_id;
|
||||
if (!dialog_id.is_valid()) {
|
||||
@ -9803,9 +9797,7 @@ void MessagesManager::on_get_messages_search_result(const string &query, int32 o
|
||||
int64 random_id, int32 total_count,
|
||||
vector<tl_object_ptr<telegram_api::Message>> &&messages,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
LOG(INFO) << "Receive " << messages.size() << " found messages";
|
||||
auto it = found_messages_.find(random_id);
|
||||
@ -9900,9 +9892,7 @@ void MessagesManager::on_get_scheduled_server_messages(DialogId dialog_id, uint3
|
||||
void MessagesManager::on_get_recent_locations(DialogId dialog_id, int32 limit, int32 total_count,
|
||||
vector<tl_object_ptr<telegram_api::Message>> &&messages,
|
||||
Promise<td_api::object_ptr<td_api::messages>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
LOG(INFO) << "Receive " << messages.size() << " recent locations in " << dialog_id;
|
||||
vector<MessageId> result;
|
||||
@ -9940,9 +9930,7 @@ void MessagesManager::on_get_recent_locations(DialogId dialog_id, int32 limit, i
|
||||
void MessagesManager::on_get_message_public_forwards(int32 total_count,
|
||||
vector<tl_object_ptr<telegram_api::Message>> &&messages,
|
||||
Promise<td_api::object_ptr<td_api::foundMessages>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
LOG(INFO) << "Receive " << messages.size() << " forwarded messages";
|
||||
vector<td_api::object_ptr<td_api::message>> result;
|
||||
@ -10281,9 +10269,7 @@ bool MessagesManager::can_revoke_message(DialogId dialog_id, const Message *m) c
|
||||
|
||||
void MessagesManager::delete_messages(DialogId dialog_id, const vector<MessageId> &input_message_ids, bool revoke,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
Dialog *d = get_dialog_force(dialog_id, "delete_messages");
|
||||
if (d == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Chat is not found"));
|
||||
@ -15543,9 +15529,7 @@ void MessagesManager::on_get_recommended_dialog_filters(
|
||||
void MessagesManager::on_load_recommended_dialog_filters(
|
||||
Result<Unit> &&result, vector<RecommendedDialogFilter> &&filters,
|
||||
Promise<td_api::object_ptr<td_api::recommendedChatFilters>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
if (result.is_error()) {
|
||||
return promise.set_error(result.move_as_error());
|
||||
}
|
||||
@ -15852,9 +15836,7 @@ void MessagesManager::load_folder_dialog_list_from_database(FolderId folder_id,
|
||||
|
||||
void MessagesManager::on_get_dialogs_from_database(FolderId folder_id, int32 limit, DialogDbGetDialogsResult &&dialogs,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
auto &folder = *get_dialog_folder(folder_id);
|
||||
LOG(INFO) << "Receive " << dialogs.dialogs.size() << " from expected " << limit << " chats in " << folder_id
|
||||
@ -16037,13 +16019,9 @@ vector<DialogId> MessagesManager::get_pinned_dialog_ids(DialogListId dialog_list
|
||||
}
|
||||
|
||||
void MessagesManager::reload_pinned_dialogs(DialogListId dialog_list_id, Promise<Unit> &&promise) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
// just in case
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
CHECK(!td_->auth_manager_->is_bot());
|
||||
|
||||
if (dialog_list_id.is_folder()) {
|
||||
send_closure(td_->create_net_actor<GetPinnedDialogsActor>(std::move(promise)), &GetPinnedDialogsActor::send,
|
||||
dialog_list_id.get_folder_id(), get_sequence_dispatcher_id(DialogId(), MessageContentType::None));
|
||||
@ -17055,9 +17033,7 @@ void MessagesManager::process_discussion_message_impl(
|
||||
telegram_api::object_ptr<telegram_api::messages_discussionMessage> &&result, DialogId dialog_id,
|
||||
MessageId message_id, DialogId expected_dialog_id, MessageId expected_message_id,
|
||||
Promise<MessageThreadInfo> promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
MessageId max_message_id;
|
||||
MessageId last_read_inbox_message_id;
|
||||
@ -17104,9 +17080,8 @@ void MessagesManager::process_discussion_message_impl(
|
||||
void MessagesManager::on_get_discussion_message(DialogId dialog_id, MessageId message_id,
|
||||
MessageThreadInfo &&message_thread_info,
|
||||
Promise<MessageThreadInfo> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
Dialog *d = get_dialog_force(dialog_id, "on_get_discussion_message");
|
||||
CHECK(d != nullptr);
|
||||
|
||||
@ -17458,9 +17433,8 @@ void MessagesManager::get_message_from_server(FullMessageId full_message_id, Pro
|
||||
void MessagesManager::get_messages_from_server(vector<FullMessageId> &&message_ids, Promise<Unit> &&promise,
|
||||
const char *source,
|
||||
tl_object_ptr<telegram_api::InputMessage> input_message) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
if (message_ids.empty()) {
|
||||
LOG(ERROR) << "Empty message_ids from " << source;
|
||||
return promise.set_error(Status::Error(500, "There are no messages specified to fetch"));
|
||||
@ -17796,9 +17770,7 @@ void MessagesManager::get_message_link_info(Slice url, Promise<MessageLinkInfo>
|
||||
}
|
||||
|
||||
void MessagesManager::on_get_message_link_dialog(MessageLinkInfo &&info, Promise<MessageLinkInfo> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
DialogId dialog_id;
|
||||
if (info.username.empty()) {
|
||||
@ -17832,9 +17804,7 @@ void MessagesManager::on_get_message_link_dialog(MessageLinkInfo &&info, Promise
|
||||
|
||||
void MessagesManager::on_get_message_link_message(MessageLinkInfo &&info, DialogId dialog_id,
|
||||
Promise<MessageLinkInfo> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
Message *m = get_message_force({dialog_id, info.message_id}, "on_get_message_link_message");
|
||||
if (info.comment_message_id == MessageId() || m == nullptr || !is_broadcast_channel(dialog_id) ||
|
||||
@ -17863,9 +17833,7 @@ void MessagesManager::on_get_message_link_message(MessageLinkInfo &&info, Dialog
|
||||
|
||||
void MessagesManager::on_get_message_link_discussion_message(MessageLinkInfo &&info, DialogId comment_dialog_id,
|
||||
Promise<MessageLinkInfo> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
CHECK(comment_dialog_id.is_valid());
|
||||
info.comment_dialog_id = comment_dialog_id;
|
||||
@ -21807,9 +21775,8 @@ void MessagesManager::on_search_dialog_messages_db_result(int64 random_id, Dialo
|
||||
MessageSearchFilter filter, int32 offset, int32 limit,
|
||||
Result<vector<MessagesDbDialogMessage>> r_messages,
|
||||
Promise<> promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
if (r_messages.is_error()) {
|
||||
LOG(ERROR) << "Failed to get messages from the database: " << r_messages.error();
|
||||
if (first_db_message_id != MessageId::min() && dialog_id.get_type() != DialogType::SecretChat &&
|
||||
@ -21954,7 +21921,7 @@ MessagesManager::FoundMessages MessagesManager::offline_search_messages(DialogId
|
||||
void MessagesManager::on_messages_db_fts_result(Result<MessagesDbFtsResult> result, string offset, int32 limit,
|
||||
int64 random_id, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
result = Status::Error(500, "Request aborted");
|
||||
result = Global::request_aborted_error();
|
||||
}
|
||||
if (result.is_error()) {
|
||||
found_fts_messages_.erase(random_id);
|
||||
@ -21987,7 +21954,7 @@ void MessagesManager::on_messages_db_calls_result(Result<MessagesDbCallsResult>
|
||||
Promise<> &&promise) {
|
||||
CHECK(!first_db_message_id.is_scheduled());
|
||||
if (G()->close_flag()) {
|
||||
result = Status::Error(500, "Request aborted");
|
||||
result = Global::request_aborted_error();
|
||||
}
|
||||
if (result.is_error()) {
|
||||
found_call_messages_.erase(random_id);
|
||||
@ -22146,9 +22113,8 @@ MessageId MessagesManager::find_message_by_date(const Message *m, int32 date) {
|
||||
void MessagesManager::on_get_dialog_message_by_date_from_database(DialogId dialog_id, int32 date, int64 random_id,
|
||||
Result<MessagesDbDialogMessage> result,
|
||||
Promise<Unit> promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
Dialog *d = get_dialog(dialog_id);
|
||||
CHECK(d != nullptr);
|
||||
if (result.is_ok()) {
|
||||
@ -22196,9 +22162,7 @@ void MessagesManager::get_dialog_message_by_date_from_server(const Dialog *d, in
|
||||
void MessagesManager::on_get_dialog_message_by_date_success(DialogId dialog_id, int32 date, int64 random_id,
|
||||
vector<tl_object_ptr<telegram_api::Message>> &&messages,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto it = get_dialog_message_by_date_results_.find(random_id);
|
||||
CHECK(it != get_dialog_message_by_date_results_.end());
|
||||
@ -22384,10 +22348,7 @@ void MessagesManager::on_get_history_from_database(DialogId dialog_id, MessageId
|
||||
CHECK(-limit < offset && offset <= 0);
|
||||
CHECK(offset < 0 || from_the_end);
|
||||
CHECK(!from_message_id.is_scheduled());
|
||||
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
LOG(WARNING) << "Ignore result of get_history_from_database in " << dialog_id;
|
||||
@ -22623,15 +22584,13 @@ void MessagesManager::get_history_from_the_end(DialogId dialog_id, bool from_dat
|
||||
void MessagesManager::get_history_from_the_end_impl(const Dialog *d, bool from_database, bool only_local,
|
||||
Promise<Unit> &&promise) {
|
||||
CHECK(d != nullptr);
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto dialog_id = d->dialog_id;
|
||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
// can't get history in dialogs without read access
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
if (!d->first_database_message_id.is_valid() && !d->have_full_history) {
|
||||
from_database = false;
|
||||
}
|
||||
@ -22681,15 +22640,13 @@ void MessagesManager::get_history_impl(const Dialog *d, MessageId from_message_i
|
||||
bool from_database, bool only_local, Promise<Unit> &&promise) {
|
||||
CHECK(d != nullptr);
|
||||
CHECK(from_message_id.is_valid());
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto dialog_id = d->dialog_id;
|
||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||
// can't get history in dialogs without read access
|
||||
return promise.set_value(Unit());
|
||||
}
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
if ((!d->first_database_message_id.is_valid() || from_message_id <= d->first_database_message_id) &&
|
||||
!d->have_full_history) {
|
||||
from_database = false;
|
||||
@ -22769,7 +22726,7 @@ vector<MessageId> MessagesManager::get_dialog_scheduled_messages(DialogId dialog
|
||||
Promise<Unit> &&promise) {
|
||||
LOG(INFO) << "Get scheduled messages in " << dialog_id;
|
||||
if (G()->close_flag()) {
|
||||
promise.set_error(Status::Error(500, "Request aborted"));
|
||||
promise.set_error(Global::request_aborted_error());
|
||||
return {};
|
||||
}
|
||||
|
||||
@ -22872,7 +22829,7 @@ void MessagesManager::on_get_scheduled_messages_from_database(DialogId dialog_id
|
||||
load_scheduled_messages_from_database_queries_.erase(it);
|
||||
|
||||
for (auto &promise : promises) {
|
||||
promise.set_error(Status::Error(500, "Request aborted"));
|
||||
promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -27046,10 +27003,7 @@ void MessagesManager::upload_imported_messages(DialogId dialog_id, FileId file_i
|
||||
|
||||
void MessagesManager::start_import_messages(DialogId dialog_id, int64 import_id, vector<FileId> &&attached_file_ids,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
TRY_STATUS_PROMISE(promise, can_send_message(dialog_id));
|
||||
|
||||
auto pending_message_import = make_unique<PendingMessageImport>();
|
||||
@ -27096,7 +27050,7 @@ void MessagesManager::upload_imported_message_attachment(DialogId dialog_id, int
|
||||
|
||||
void MessagesManager::on_imported_message_attachments_uploaded(int64 random_id, Result<Unit> &&result) {
|
||||
if (G()->close_flag()) {
|
||||
result = Status::Error(500, "Request aborted");
|
||||
result = Global::request_aborted_error();
|
||||
}
|
||||
|
||||
auto it = pending_message_imports_.find(random_id);
|
||||
@ -27827,7 +27781,7 @@ void MessagesManager::on_get_message_notifications_from_database(DialogId dialog
|
||||
Result<vector<MessagesDbDialogMessage>> result,
|
||||
Promise<vector<Notification>> promise) {
|
||||
if (G()->close_flag()) {
|
||||
result = Status::Error(500, "Request aborted");
|
||||
result = Global::request_aborted_error();
|
||||
}
|
||||
if (result.is_error()) {
|
||||
return promise.set_error(result.move_as_error());
|
||||
@ -30586,9 +30540,8 @@ uint64 MessagesManager::save_get_dialog_from_server_log_event(DialogId dialog_id
|
||||
|
||||
void MessagesManager::send_get_dialog_query(DialogId dialog_id, Promise<Unit> &&promise, uint64 log_event_id,
|
||||
const char *source) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
if (td_->auth_manager_->is_bot() || dialog_id.get_type() == DialogType::SecretChat) {
|
||||
if (log_event_id != 0) {
|
||||
binlog_erase(G()->td_db()->get_binlog(), log_event_id);
|
||||
|
@ -839,7 +839,7 @@ void PasswordManager::start_up() {
|
||||
|
||||
void PasswordManager::hangup() {
|
||||
container_.for_each(
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Status::Error(500, "Request aborted")); });
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Global::request_aborted_error()); });
|
||||
stop();
|
||||
}
|
||||
|
||||
|
@ -561,7 +561,7 @@ void PrivacyManager::send_with_promise(NetQueryPtr query, Promise<NetQueryPtr> p
|
||||
|
||||
void PrivacyManager::hangup() {
|
||||
container_.for_each(
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Status::Error(500, "Request aborted")); });
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Global::request_aborted_error()); });
|
||||
stop();
|
||||
}
|
||||
|
||||
|
@ -131,7 +131,7 @@ void RecentDialogList::on_load_dialogs(vector<string> &&found_dialogs) {
|
||||
|
||||
if (G()->close_flag()) {
|
||||
for (auto &promise : promises) {
|
||||
promise.set_error(Status::Error(500, "Request aborted"));
|
||||
promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/AuthManager.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/Td.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
|
||||
@ -127,7 +128,7 @@ class RequestActor : public Actor {
|
||||
}
|
||||
|
||||
void hangup() final {
|
||||
do_send_error(Status::Error(500, "Request aborted"));
|
||||
do_send_error(Global::request_aborted_error());
|
||||
stop();
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ void SetSecureValue::loop() {
|
||||
}
|
||||
|
||||
void SetSecureValue::hangup() {
|
||||
on_error(Status::Error(406, "Request aborted"));
|
||||
on_error(Status::Error(406, "Request canceled"));
|
||||
}
|
||||
|
||||
void SetSecureValue::tear_down() {
|
||||
@ -1294,7 +1294,7 @@ void SecureManager::get_preferred_country_language(string country_code,
|
||||
|
||||
void SecureManager::hangup() {
|
||||
container_.for_each(
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Status::Error(500, "Request aborted")); });
|
||||
[](auto id, Promise<NetQueryPtr> &promise) { promise.set_error(Global::request_aborted_error()); });
|
||||
dec_refcnt();
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ void SequenceDispatcher::tear_down() {
|
||||
continue;
|
||||
}
|
||||
data.state_ = State::Dummy;
|
||||
data.query_->set_error(Status::Error(500, "Request aborted"));
|
||||
data.query_->set_error(Global::request_aborted_error());
|
||||
do_finish(data);
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ void SponsoredMessageManager::on_get_dialog_sponsored_messages(
|
||||
CHECK(messages->message_random_ids.empty());
|
||||
|
||||
if (result.is_ok() && G()->close_flag()) {
|
||||
result = Status::Error(500, "Request aborted");
|
||||
result = Global::request_aborted_error();
|
||||
}
|
||||
if (result.is_error()) {
|
||||
dialog_sponsored_messages_.erase(dialog_id);
|
||||
|
@ -3846,9 +3846,7 @@ void StickersManager::reload_sticker_set(StickerSetId sticker_set_id, int64 acce
|
||||
void StickersManager::do_reload_sticker_set(StickerSetId sticker_set_id,
|
||||
tl_object_ptr<telegram_api::InputStickerSet> &&input_sticker_set,
|
||||
Promise<Unit> &&promise) const {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
td_->create_handler<GetStickerSetQuery>(std::move(promise))->send(sticker_set_id, std::move(input_sticker_set));
|
||||
}
|
||||
|
||||
@ -4154,9 +4152,7 @@ void StickersManager::choose_animated_emoji_click_sticker(const StickerSet *stic
|
||||
|
||||
void StickersManager::send_click_animated_emoji_message_response(
|
||||
FileId sticker_id, Promise<td_api::object_ptr<td_api::sticker>> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
promise.set_value(get_sticker_object(sticker_id));
|
||||
}
|
||||
|
||||
@ -5453,7 +5449,7 @@ void StickersManager::on_new_stickers_uploaded(int64 random_id, Result<Unit> res
|
||||
pending_new_sticker_sets_.erase(it);
|
||||
|
||||
if (G()->close_flag()) {
|
||||
result = Status::Error(500, "Request aborted");
|
||||
result = Global::request_aborted_error();
|
||||
}
|
||||
if (result.is_error()) {
|
||||
pending_new_sticker_set->promise.set_error(result.move_as_error());
|
||||
@ -5591,9 +5587,7 @@ void StickersManager::set_sticker_set_thumbnail(UserId user_id, string &short_na
|
||||
void StickersManager::do_set_sticker_set_thumbnail(UserId user_id, string short_name,
|
||||
tl_object_ptr<td_api::InputFile> &&thumbnail,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto it = short_name_to_sticker_set_id_.find(short_name);
|
||||
const StickerSet *sticker_set = it == short_name_to_sticker_set_id_.end() ? nullptr : get_sticker_set(it->second);
|
||||
@ -6016,9 +6010,7 @@ void StickersManager::add_recent_sticker(bool is_attached, const tl_object_ptr<t
|
||||
|
||||
void StickersManager::send_save_recent_sticker_query(bool is_attached, FileId sticker_id, bool unsave,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
// TODO invokeAfter and log event
|
||||
auto file_view = td_->file_manager_->get_file_view(sticker_id);
|
||||
@ -6411,9 +6403,7 @@ void StickersManager::add_favorite_sticker(const tl_object_ptr<td_api::InputFile
|
||||
}
|
||||
|
||||
void StickersManager::send_fave_sticker_query(FileId sticker_id, bool unsave, Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
// TODO invokeAfter and log event
|
||||
auto file_view = td_->file_manager_->get_file_view(sticker_id);
|
||||
|
@ -63,8 +63,7 @@ void StorageManager::on_new_file(int64 size, int64 real_size, int32 cnt) {
|
||||
|
||||
void StorageManager::get_storage_stats(bool need_all_files, int32 dialog_limit, Promise<FileStats> promise) {
|
||||
if (is_closed_) {
|
||||
promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return;
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
if (pending_storage_stats_.size() != 0) {
|
||||
if (stats_dialog_limit_ == dialog_limit && need_all_files == stats_need_all_files_) {
|
||||
@ -111,7 +110,7 @@ void StorageManager::update_use_storage_optimizer() {
|
||||
void StorageManager::run_gc(FileGcParameters parameters, bool return_deleted_file_statistics,
|
||||
Promise<FileStats> promise) {
|
||||
if (is_closed_) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
if (!pending_run_gc_[0].empty() || !pending_run_gc_[1].empty()) {
|
||||
close_gc_worker();
|
||||
@ -158,7 +157,7 @@ void StorageManager::create_stats_worker() {
|
||||
void StorageManager::on_all_files(FileGcParameters gc_parameters, Result<FileStats> r_file_stats) {
|
||||
int32 dialog_limit = gc_parameters.dialog_limit;
|
||||
if (is_closed_ && r_file_stats.is_ok()) {
|
||||
r_file_stats = Status::Error(500, "Request aborted");
|
||||
r_file_stats = Global::request_aborted_error();
|
||||
}
|
||||
if (r_file_stats.is_error()) {
|
||||
return on_gc_finished(dialog_limit, r_file_stats.move_as_error());
|
||||
@ -291,7 +290,7 @@ void StorageManager::close_stats_worker() {
|
||||
auto promises = std::move(pending_storage_stats_);
|
||||
pending_storage_stats_.clear();
|
||||
for (auto &promise : promises) {
|
||||
promise.set_error(Status::Error(500, "Request aborted"));
|
||||
promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
stats_generation_++;
|
||||
stats_worker_.reset();
|
||||
@ -304,7 +303,7 @@ void StorageManager::close_gc_worker() {
|
||||
pending_run_gc_[0].clear();
|
||||
pending_run_gc_[1].clear();
|
||||
for (auto &promise : promises) {
|
||||
promise.set_error(Status::Error(500, "Request aborted"));
|
||||
promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
gc_worker_.reset();
|
||||
gc_cancellation_token_source_.cancel();
|
||||
|
@ -907,9 +907,7 @@ void WebPagesManager::reload_web_page_instant_view(WebPageId web_page_id) {
|
||||
std::move(result));
|
||||
});
|
||||
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
td_->create_handler<GetWebPageQuery>(std::move(promise))
|
||||
->send(web_page_id, web_page->url, web_page->instant_view.is_full ? web_page->instant_view.hash : 0);
|
||||
@ -967,7 +965,7 @@ void WebPagesManager::on_load_web_page_instant_view_from_database(WebPageId web_
|
||||
void WebPagesManager::update_web_page_instant_view_load_requests(WebPageId web_page_id, bool force_update,
|
||||
Result<WebPageId> r_web_page_id) {
|
||||
if (G()->close_flag()) {
|
||||
r_web_page_id = Status::Error(500, "Request aborted");
|
||||
r_web_page_id = Global::request_aborted_error();
|
||||
}
|
||||
LOG(INFO) << "Update load requests for " << web_page_id;
|
||||
auto it = load_web_page_instant_view_queries_.find(web_page_id);
|
||||
@ -1072,9 +1070,7 @@ void WebPagesManager::load_web_page_by_url(const string &url, Promise<WebPageId>
|
||||
}
|
||||
|
||||
void WebPagesManager::on_load_web_page_id_by_url_from_database(string url, string value, Promise<WebPageId> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
LOG(INFO) << "Successfully loaded url \"" << url << "\" of size " << value.size() << " from database";
|
||||
// G()->td_db()->get_sqlite_pmc()->erase(get_web_page_url_database_key(web_page_id), Auto());
|
||||
@ -1114,7 +1110,7 @@ void WebPagesManager::on_load_web_page_by_url_from_database(WebPageId web_page_i
|
||||
Promise<WebPageId> &&promise, Result<Unit> &&result) {
|
||||
if (result.is_error()) {
|
||||
CHECK(G()->close_flag());
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
|
||||
const WebPage *web_page = get_web_page(web_page_id);
|
||||
@ -1130,11 +1126,7 @@ void WebPagesManager::on_load_web_page_by_url_from_database(WebPageId web_page_i
|
||||
}
|
||||
|
||||
void WebPagesManager::reload_web_page_by_url(const string &url, Promise<WebPageId> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
|
||||
LOG(INFO) << "Reload url \"" << url << '"';
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
td_->create_handler<GetWebPageQuery>(std::move(promise))->send(WebPageId(), url, 0);
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ void FileGcWorker::run_gc(const FileGcParameters ¶meters, std::vector<FullFi
|
||||
return false;
|
||||
});
|
||||
if (token_) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
|
||||
// sort by max(atime, mtime)
|
||||
@ -152,7 +152,7 @@ void FileGcWorker::run_gc(const FileGcParameters ¶meters, std::vector<FullFi
|
||||
size_t pos = 0;
|
||||
while (pos < files.size() && (remove_count > 0 || remove_size > 0)) {
|
||||
if (token_) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
if (remove_count > 0) {
|
||||
remove_by_count_cnt++;
|
||||
|
@ -1745,11 +1745,7 @@ void FileManager::change_files_source(FileSourceId file_source_id, const vector<
|
||||
|
||||
void FileManager::on_file_reference_repaired(FileId file_id, FileSourceId file_source_id, Result<Unit> &&result,
|
||||
Promise<Unit> &&promise) {
|
||||
if (G()->close_flag()) {
|
||||
VLOG(file_references) << "Ignore file reference of file " << file_id << " repair from " << file_source_id
|
||||
<< " during closing";
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
auto file_view = get_file_view(file_id);
|
||||
CHECK(!file_view.empty());
|
||||
@ -2035,9 +2031,7 @@ void FileManager::get_content(FileId file_id, Promise<BufferSlice> promise) {
|
||||
|
||||
void FileManager::read_file_part(FileId file_id, int32 offset, int32 count, int left_tries,
|
||||
Promise<td_api::object_ptr<td_api::filePart>> promise) {
|
||||
if (G()->close_flag()) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
}
|
||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||
|
||||
if (!file_id.is_valid()) {
|
||||
return promise.set_error(Status::Error(400, "File identifier is invalid"));
|
||||
@ -3877,7 +3871,7 @@ void FileManager::hangup() {
|
||||
while (!queries_container_.empty()) {
|
||||
auto ids = queries_container_.ids();
|
||||
for (auto id : ids) {
|
||||
on_error(id, Status::Error(500, "Request aborted"));
|
||||
on_error(id, Global::request_aborted_error());
|
||||
}
|
||||
}
|
||||
is_closed_ = true;
|
||||
|
@ -161,7 +161,7 @@ void FileStatsWorker::get_stats(bool need_all_files, bool split_by_owner_dialog_
|
||||
auto passed = Time::now() - start;
|
||||
LOG_IF(INFO, passed > 0.5) << "Get file stats took: " << format::as_time(passed);
|
||||
if (token_) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
promise.set_value(std::move(file_stats));
|
||||
} else {
|
||||
@ -182,7 +182,7 @@ void FileStatsWorker::get_stats(bool need_all_files, bool split_by_owner_dialog_
|
||||
});
|
||||
|
||||
if (token_) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
|
||||
std::unordered_map<size_t, size_t> hash_to_pos;
|
||||
@ -191,7 +191,7 @@ void FileStatsWorker::get_stats(bool need_all_files, bool split_by_owner_dialog_
|
||||
hash_to_pos[std::hash<std::string>()(full_info.path)] = pos;
|
||||
pos++;
|
||||
if (token_) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
}
|
||||
scan_db(token_, [&](DbFileInfo &db_info) {
|
||||
@ -203,14 +203,14 @@ void FileStatsWorker::get_stats(bool need_all_files, bool split_by_owner_dialog_
|
||||
full_infos[it->second].owner_dialog_id = db_info.owner_dialog_id;
|
||||
});
|
||||
if (token_) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
|
||||
FileStats file_stats(need_all_files, split_by_owner_dialog_id);
|
||||
for (auto &full_info : full_infos) {
|
||||
file_stats.add(std::move(full_info));
|
||||
if (token_) {
|
||||
return promise.set_error(Status::Error(500, "Request aborted"));
|
||||
return promise.set_error(Global::request_aborted_error());
|
||||
}
|
||||
}
|
||||
auto passed = Time::now() - start;
|
||||
|
@ -6,6 +6,7 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/net/NetQuery.h"
|
||||
|
||||
#include "td/actor/actor.h"
|
||||
@ -40,7 +41,7 @@ class NetActor : public NetQueryCallback {
|
||||
|
||||
class NetActorOnce : public NetActor {
|
||||
void hangup() override {
|
||||
on_error(0, Status::Error(500, "Request aborted"));
|
||||
on_error(0, Global::request_aborted_error());
|
||||
stop();
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ void NetQueryDelayer::on_slot_event(uint64 id) {
|
||||
|
||||
void NetQueryDelayer::tear_down() {
|
||||
container_.for_each([](auto id, auto &query_slot) {
|
||||
query_slot.query_->set_error(Status::Error(500, "Request aborted"));
|
||||
query_slot.query_->set_error(Global::request_aborted_error());
|
||||
G()->net_query_dispatcher().dispatch(std::move(query_slot.query_));
|
||||
});
|
||||
}
|
||||
|
@ -6,6 +6,8 @@
|
||||
//
|
||||
#include "td/telegram/net/NetQueryDispatcher.h"
|
||||
|
||||
#include "td/telegram/ConfigShared.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/net/AuthDataShared.h"
|
||||
#include "td/telegram/net/DcAuthManager.h"
|
||||
#include "td/telegram/net/NetQuery.h"
|
||||
@ -13,9 +15,6 @@
|
||||
#include "td/telegram/net/PublicRsaKeyShared.h"
|
||||
#include "td/telegram/net/PublicRsaKeyWatchdog.h"
|
||||
#include "td/telegram/net/SessionMultiProxy.h"
|
||||
|
||||
#include "td/telegram/ConfigShared.h"
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/Td.h"
|
||||
#include "td/telegram/TdDb.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
@ -44,7 +43,7 @@ void NetQueryDispatcher::complete_net_query(NetQueryPtr net_query) {
|
||||
void NetQueryDispatcher::dispatch(NetQueryPtr net_query) {
|
||||
// net_query->debug("dispatch");
|
||||
if (stop_flag_.load(std::memory_order_relaxed)) {
|
||||
net_query->set_error(Status::Error(500, "Request aborted"));
|
||||
net_query->set_error(Global::request_aborted_error());
|
||||
return complete_net_query(std::move(net_query));
|
||||
}
|
||||
if (G()->shared_config().get_option_boolean("test_flood_wait")) {
|
||||
|
Loading…
Reference in New Issue
Block a user