Check for close status as early as possible.
This commit is contained in:
parent
12d852abc5
commit
f342b65500
@ -352,10 +352,11 @@ void CallActor::on_save_debug_query_result(Result<NetQueryPtr> r_net_query) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CallActor::send_call_log(td_api::object_ptr<td_api::InputFile> log_file, Promise<Unit> promise) {
|
void CallActor::send_call_log(td_api::object_ptr<td_api::InputFile> log_file, Promise<Unit> promise) {
|
||||||
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
|
|
||||||
if (!call_state_.need_log) {
|
if (!call_state_.need_log) {
|
||||||
return promise.set_error(Status::Error(400, "Unexpected sendCallLog"));
|
return promise.set_error(Status::Error(400, "Unexpected sendCallLog"));
|
||||||
}
|
}
|
||||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
|
||||||
|
|
||||||
auto *file_manager = G()->td().get_actor_unsafe()->file_manager_.get();
|
auto *file_manager = G()->td().get_actor_unsafe()->file_manager_.get();
|
||||||
auto r_file_id = file_manager->get_input_file_id(FileType::CallLog, log_file, DialogId(), false, false);
|
auto r_file_id = file_manager->get_input_file_id(FileType::CallLog, log_file, DialogId(), false, false);
|
||||||
@ -418,18 +419,19 @@ void CallActor::upload_log_file(FileId file_id, Promise<Unit> &&promise) {
|
|||||||
|
|
||||||
void CallActor::on_upload_log_file(FileId file_id, Promise<Unit> &&promise,
|
void CallActor::on_upload_log_file(FileId file_id, Promise<Unit> &&promise,
|
||||||
tl_object_ptr<telegram_api::InputFile> input_file) {
|
tl_object_ptr<telegram_api::InputFile> input_file) {
|
||||||
LOG(INFO) << "Log file " << file_id << " has been uploaded";
|
|
||||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
|
|
||||||
|
LOG(INFO) << "Log file " << file_id << " has been uploaded";
|
||||||
|
|
||||||
do_upload_log_file(file_id, std::move(input_file), std::move(promise));
|
do_upload_log_file(file_id, std::move(input_file), std::move(promise));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallActor::on_upload_log_file_error(FileId file_id, Promise<Unit> &&promise, Status status) {
|
void CallActor::on_upload_log_file_error(FileId file_id, Promise<Unit> &&promise, Status status) {
|
||||||
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
|
|
||||||
LOG(WARNING) << "Log file " << file_id << " has upload error " << status;
|
LOG(WARNING) << "Log file " << file_id << " has upload error " << status;
|
||||||
CHECK(status.is_error());
|
CHECK(status.is_error());
|
||||||
|
|
||||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
|
||||||
|
|
||||||
promise.set_error(Status::Error(status.code() > 0 ? status.code() : 500,
|
promise.set_error(Status::Error(status.code() > 0 ? status.code() : 500,
|
||||||
status.message())); // TODO CHECK that status has always a code
|
status.message())); // TODO CHECK that status has always a code
|
||||||
}
|
}
|
||||||
|
@ -8058,7 +8058,7 @@ void ContactsManager::reload_created_public_dialogs(PublicDialogType type,
|
|||||||
|
|
||||||
void ContactsManager::finish_get_created_public_dialogs(PublicDialogType type, Result<Unit> &&result) {
|
void ContactsManager::finish_get_created_public_dialogs(PublicDialogType type, Result<Unit> &&result) {
|
||||||
if (G()->close_flag()) {
|
if (G()->close_flag()) {
|
||||||
result = G()->close_status();
|
result = Global::request_aborted_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto index = static_cast<int32>(type);
|
auto index = static_cast<int32>(type);
|
||||||
|
@ -23747,10 +23747,10 @@ void MessagesManager::on_get_history_from_database(DialogId dialog_id, MessageId
|
|||||||
bool from_the_end, bool only_local,
|
bool from_the_end, bool only_local,
|
||||||
vector<MessagesDbDialogMessage> &&messages,
|
vector<MessagesDbDialogMessage> &&messages,
|
||||||
Promise<Unit> &&promise) {
|
Promise<Unit> &&promise) {
|
||||||
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
CHECK(-limit < offset && offset <= 0);
|
CHECK(-limit < offset && offset <= 0);
|
||||||
CHECK(offset < 0 || from_the_end);
|
CHECK(offset < 0 || from_the_end);
|
||||||
CHECK(!from_message_id.is_scheduled());
|
CHECK(!from_message_id.is_scheduled());
|
||||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
|
||||||
|
|
||||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||||
LOG(WARNING) << "Ignore result of get_history_from_database in " << dialog_id;
|
LOG(WARNING) << "Ignore result of get_history_from_database in " << dialog_id;
|
||||||
@ -24008,8 +24008,8 @@ 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,
|
void MessagesManager::get_history_from_the_end_impl(const Dialog *d, bool from_database, bool only_local,
|
||||||
Promise<Unit> &&promise, const char *source) {
|
Promise<Unit> &&promise, const char *source) {
|
||||||
CHECK(d != nullptr);
|
|
||||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
|
CHECK(d != nullptr);
|
||||||
|
|
||||||
auto dialog_id = d->dialog_id;
|
auto dialog_id = d->dialog_id;
|
||||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||||
@ -24063,9 +24063,9 @@ void MessagesManager::get_history(DialogId dialog_id, MessageId from_message_id,
|
|||||||
|
|
||||||
void MessagesManager::get_history_impl(const Dialog *d, MessageId from_message_id, int32 offset, int32 limit,
|
void MessagesManager::get_history_impl(const Dialog *d, MessageId from_message_id, int32 offset, int32 limit,
|
||||||
bool from_database, bool only_local, Promise<Unit> &&promise) {
|
bool from_database, bool only_local, Promise<Unit> &&promise) {
|
||||||
|
TRY_STATUS_PROMISE(promise, G()->close_status());
|
||||||
CHECK(d != nullptr);
|
CHECK(d != nullptr);
|
||||||
CHECK(from_message_id.is_valid());
|
CHECK(from_message_id.is_valid());
|
||||||
TRY_STATUS_PROMISE(promise, G()->close_status());
|
|
||||||
|
|
||||||
auto dialog_id = d->dialog_id;
|
auto dialog_id = d->dialog_id;
|
||||||
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
if (!have_input_peer(dialog_id, AccessRights::Read)) {
|
||||||
|
@ -3882,7 +3882,7 @@ std::pair<vector<FileId>, vector<FileId>> StickersManager::split_stickers_by_pre
|
|||||||
vector<FileId> StickersManager::get_stickers(StickerType sticker_type, string emoji, int32 limit, DialogId dialog_id,
|
vector<FileId> StickersManager::get_stickers(StickerType sticker_type, string emoji, int32 limit, DialogId dialog_id,
|
||||||
bool force, Promise<Unit> &&promise) {
|
bool force, Promise<Unit> &&promise) {
|
||||||
if (G()->close_flag()) {
|
if (G()->close_flag()) {
|
||||||
promise.set_error(G()->close_status());
|
promise.set_error(Global::request_aborted_error());
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8619,7 +8619,7 @@ void StickersManager::on_get_emoji_keywords_difference(
|
|||||||
const string &language_code, int32 from_version,
|
const string &language_code, int32 from_version,
|
||||||
Result<telegram_api::object_ptr<telegram_api::emojiKeywordsDifference>> &&result) {
|
Result<telegram_api::object_ptr<telegram_api::emojiKeywordsDifference>> &&result) {
|
||||||
if (G()->close_flag()) {
|
if (G()->close_flag()) {
|
||||||
result = G()->close_status();
|
result = Global::request_aborted_error();
|
||||||
}
|
}
|
||||||
if (result.is_error()) {
|
if (result.is_error()) {
|
||||||
if (!G()->is_expected_error(result.error())) {
|
if (!G()->is_expected_error(result.error())) {
|
||||||
|
Loading…
Reference in New Issue
Block a user