Prefer US spelling of "canceled".
This commit is contained in:
parent
181e48685e
commit
9cecc116f3
@ -52,7 +52,7 @@ authenticationCodeTypeSms length:int32 = AuthenticationCodeType;
|
|||||||
//@description An authentication code is delivered via a phone call to the specified phone number @length Length of the code
|
//@description An authentication code is delivered via a phone call to the specified phone number @length Length of the code
|
||||||
authenticationCodeTypeCall length:int32 = AuthenticationCodeType;
|
authenticationCodeTypeCall length:int32 = AuthenticationCodeType;
|
||||||
|
|
||||||
//@description An authentication code is delivered by an immediately cancelled call to the specified phone number. The number from which the call was made is the code @pattern Pattern of the phone number from which the call will be made
|
//@description An authentication code is delivered by an immediately canceled call to the specified phone number. The number from which the call was made is the code @pattern Pattern of the phone number from which the call will be made
|
||||||
authenticationCodeTypeFlashCall pattern:string = AuthenticationCodeType;
|
authenticationCodeTypeFlashCall pattern:string = AuthenticationCodeType;
|
||||||
|
|
||||||
|
|
||||||
@ -2028,7 +2028,7 @@ chatActionStartPlayingGame = ChatAction;
|
|||||||
chatActionRecordingVideoNote = ChatAction;
|
chatActionRecordingVideoNote = ChatAction;
|
||||||
//@description The user is uploading a video note @progress Upload progress, as a percentage
|
//@description The user is uploading a video note @progress Upload progress, as a percentage
|
||||||
chatActionUploadingVideoNote progress:int32 = ChatAction;
|
chatActionUploadingVideoNote progress:int32 = ChatAction;
|
||||||
//@description The user has cancelled the previous action
|
//@description The user has canceled the previous action
|
||||||
chatActionCancel = ChatAction;
|
chatActionCancel = ChatAction;
|
||||||
|
|
||||||
|
|
||||||
@ -2084,7 +2084,7 @@ stickerSets total_count:int32 sets:vector<stickerSetInfo> = StickerSets;
|
|||||||
//@description The call wasn't discarded, or the reason is unknown
|
//@description The call wasn't discarded, or the reason is unknown
|
||||||
callDiscardReasonEmpty = CallDiscardReason;
|
callDiscardReasonEmpty = CallDiscardReason;
|
||||||
|
|
||||||
//@description The call was ended before the conversation started. It was cancelled by the caller or missed by the other party
|
//@description The call was ended before the conversation started. It was canceled by the caller or missed by the other party
|
||||||
callDiscardReasonMissed = CallDiscardReason;
|
callDiscardReasonMissed = CallDiscardReason;
|
||||||
|
|
||||||
//@description The call was ended before the conversation started. It was declined by the other party
|
//@description The call was ended before the conversation started. It was declined by the other party
|
||||||
@ -4536,9 +4536,9 @@ setPinnedChats chat_list:ChatList chat_ids:vector<int53> = Ok;
|
|||||||
//@file_id Identifier of the file to download
|
//@file_id Identifier of the file to download
|
||||||
//@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first
|
//@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first
|
||||||
//@offset The starting position from which the file should be downloaded
|
//@offset The starting position from which the file should be downloaded
|
||||||
//@limit Number of bytes which should be downloaded starting from the "offset" position before the download will be automatically cancelled; use 0 to download without a limit
|
//@limit Number of bytes which should be downloaded starting from the "offset" position before the download will be automatically canceled; use 0 to download without a limit
|
||||||
//@synchronous If false, this request returns file state just after the download has been started. If true, this request returns file state only after
|
//@synchronous If false, this request returns file state just after the download has been started. If true, this request returns file state only after
|
||||||
//-the download has succeeded, has failed, has been cancelled or a new downloadFile request with different offset/limit parameters was sent
|
//-the download has succeeded, has failed, has been canceled or a new downloadFile request with different offset/limit parameters was sent
|
||||||
downloadFile file_id:int32 priority:int32 offset:int32 limit:int32 synchronous:Bool = File;
|
downloadFile file_id:int32 priority:int32 offset:int32 limit:int32 synchronous:Bool = File;
|
||||||
|
|
||||||
//@description Returns file downloaded prefix size from a given offset @file_id Identifier of the file @offset Offset from which downloaded prefix size should be calculated
|
//@description Returns file downloaded prefix size from a given offset @file_id Identifier of the file @offset Offset from which downloaded prefix size should be calculated
|
||||||
|
@ -27,7 +27,7 @@ HandshakeActor::HandshakeActor(unique_ptr<AuthKeyHandshake> handshake, unique_pt
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HandshakeActor::close() {
|
void HandshakeActor::close() {
|
||||||
finish(Status::Error("Cancelled"));
|
finish(Status::Error("Canceled"));
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ class HandshakeActor : public Actor {
|
|||||||
finish(Status::OK());
|
finish(Status::OK());
|
||||||
}
|
}
|
||||||
void hangup() override {
|
void hangup() override {
|
||||||
finish(Status::Error(1, "Cancelled"));
|
finish(Status::Error(1, "Canceled"));
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
void timeout_expired() override {
|
void timeout_expired() override {
|
||||||
|
@ -45,7 +45,7 @@ ActorOwn<> create_ping_actor(string debug, unique_ptr<RawConnection> raw_connect
|
|||||||
}
|
}
|
||||||
|
|
||||||
void hangup() override {
|
void hangup() override {
|
||||||
finish(Status::Error("Cancelled"));
|
finish(Status::Error("Canceled"));
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,7 +262,7 @@ tl_object_ptr<td_api::ChatAction> DialogAction::get_chat_action_object() const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DialogAction::is_cancelled_by_message_of_type(MessageContentType message_content_type) const {
|
bool DialogAction::is_canceled_by_message_of_type(MessageContentType message_content_type) const {
|
||||||
if (message_content_type == MessageContentType::None) {
|
if (message_content_type == MessageContentType::None) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class DialogAction {
|
|||||||
|
|
||||||
td_api::object_ptr<td_api::ChatAction> get_chat_action_object() const;
|
td_api::object_ptr<td_api::ChatAction> get_chat_action_object() const;
|
||||||
|
|
||||||
bool is_cancelled_by_message_of_type(MessageContentType message_content_type) const;
|
bool is_canceled_by_message_of_type(MessageContentType message_content_type) const;
|
||||||
|
|
||||||
static DialogAction get_uploading_action(MessageContentType message_content_type, int32 progress);
|
static DialogAction get_uploading_action(MessageContentType message_content_type, int32 progress);
|
||||||
|
|
||||||
|
@ -2236,7 +2236,7 @@ int32 GroupCallManager::cancel_join_group_call_request(InputGroupCallId input_gr
|
|||||||
if (!it->second->query_ref.empty()) {
|
if (!it->second->query_ref.empty()) {
|
||||||
cancel_query(it->second->query_ref);
|
cancel_query(it->second->query_ref);
|
||||||
}
|
}
|
||||||
it->second->promise.set_error(Status::Error(200, "Cancelled"));
|
it->second->promise.set_error(Status::Error(200, "Canceled"));
|
||||||
auto audio_source = it->second->audio_source;
|
auto audio_source = it->second->audio_source;
|
||||||
pending_join_requests_.erase(it);
|
pending_join_requests_.erase(it);
|
||||||
return audio_source;
|
return audio_source;
|
||||||
@ -2252,7 +2252,7 @@ int32 GroupCallManager::cancel_join_group_call_presentation_request(InputGroupCa
|
|||||||
if (!it->second->query_ref.empty()) {
|
if (!it->second->query_ref.empty()) {
|
||||||
cancel_query(it->second->query_ref);
|
cancel_query(it->second->query_ref);
|
||||||
}
|
}
|
||||||
it->second->promise.set_error(Status::Error(200, "Cancelled"));
|
it->second->promise.set_error(Status::Error(200, "Canceled"));
|
||||||
auto audio_source = it->second->audio_source;
|
auto audio_source = it->second->audio_source;
|
||||||
pending_join_presentation_requests_.erase(it);
|
pending_join_presentation_requests_.erase(it);
|
||||||
return audio_source;
|
return audio_source;
|
||||||
|
@ -104,8 +104,8 @@ class GetInlineBotResultsQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_error(uint64 id, Status status) override {
|
void on_error(uint64 id, Status status) override {
|
||||||
if (status.code() == NetQuery::Cancelled) {
|
if (status.code() == NetQuery::Canceled) {
|
||||||
status = Status::Error(406, "Request cancelled");
|
status = Status::Error(406, "Request canceled");
|
||||||
} else if (status.message() == "BOT_RESPONSE_TIMEOUT") {
|
} else if (status.message() == "BOT_RESPONSE_TIMEOUT") {
|
||||||
status = Status::Error(502, "The bot is not responding");
|
status = Status::Error(502, "The bot is not responding");
|
||||||
}
|
}
|
||||||
@ -828,7 +828,7 @@ uint64 InlineQueriesManager::send_inline_query(UserId bot_user_id, DialogId dial
|
|||||||
LOG(INFO) << "Drop inline query " << pending_inline_query_->query_hash;
|
LOG(INFO) << "Drop inline query " << pending_inline_query_->query_hash;
|
||||||
on_get_inline_query_results(pending_inline_query_->dialog_id, pending_inline_query_->bot_user_id,
|
on_get_inline_query_results(pending_inline_query_->dialog_id, pending_inline_query_->bot_user_id,
|
||||||
pending_inline_query_->query_hash, nullptr);
|
pending_inline_query_->query_hash, nullptr);
|
||||||
pending_inline_query_->promise.set_error(Status::Error(406, "Request cancelled"));
|
pending_inline_query_->promise.set_error(Status::Error(406, "Request canceled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
pending_inline_query_ = make_unique<PendingInlineQuery>(PendingInlineQuery{
|
pending_inline_query_ = make_unique<PendingInlineQuery>(PendingInlineQuery{
|
||||||
|
@ -3854,7 +3854,7 @@ class SetTypingQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_error(uint64 id, Status status) override {
|
void on_error(uint64 id, Status status) override {
|
||||||
if (status.code() == NetQuery::Cancelled) {
|
if (status.code() == NetQuery::Canceled) {
|
||||||
return promise_.set_value(Unit());
|
return promise_.set_value(Unit());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7174,7 +7174,7 @@ void MessagesManager::on_user_dialog_action(DialogId dialog_id, MessageId top_th
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!td_->contacts_manager_->is_user_bot(user_id) &&
|
if (!td_->contacts_manager_->is_user_bot(user_id) &&
|
||||||
!it->action.is_cancelled_by_message_of_type(message_content_type)) {
|
!it->action.is_canceled_by_message_of_type(message_content_type)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8543,7 +8543,7 @@ void MessagesManager::on_upload_media(FileId file_id, tl_object_ptr<telegram_api
|
|||||||
|
|
||||||
auto it = being_uploaded_files_.find(file_id);
|
auto it = being_uploaded_files_.find(file_id);
|
||||||
if (it == being_uploaded_files_.end()) {
|
if (it == being_uploaded_files_.end()) {
|
||||||
// callback may be called just before the file upload was cancelled
|
// callback may be called just before the file upload was canceled
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8555,7 +8555,7 @@ void MessagesManager::on_upload_media(FileId file_id, tl_object_ptr<telegram_api
|
|||||||
Message *m = get_message(full_message_id);
|
Message *m = get_message(full_message_id);
|
||||||
if (m == nullptr) {
|
if (m == nullptr) {
|
||||||
// message has already been deleted by the user or sent to inaccessible channel, do not need to send or edit it
|
// message has already been deleted by the user or sent to inaccessible channel, do not need to send or edit it
|
||||||
// file upload should be already cancelled in cancel_send_message_query, it shouldn't happen
|
// file upload should be already canceled in cancel_send_message_query, it shouldn't happen
|
||||||
LOG(ERROR) << "Message with a media has already been deleted";
|
LOG(ERROR) << "Message with a media has already been deleted";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -8665,7 +8665,7 @@ void MessagesManager::on_upload_media_error(FileId file_id, Status status) {
|
|||||||
|
|
||||||
auto it = being_uploaded_files_.find(file_id);
|
auto it = being_uploaded_files_.find(file_id);
|
||||||
if (it == being_uploaded_files_.end()) {
|
if (it == being_uploaded_files_.end()) {
|
||||||
// callback may be called just before the file upload was cancelled
|
// callback may be called just before the file upload was canceled
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8739,7 +8739,7 @@ void MessagesManager::on_upload_thumbnail(FileId thumbnail_file_id,
|
|||||||
|
|
||||||
auto it = being_uploaded_thumbnails_.find(thumbnail_file_id);
|
auto it = being_uploaded_thumbnails_.find(thumbnail_file_id);
|
||||||
if (it == being_uploaded_thumbnails_.end()) {
|
if (it == being_uploaded_thumbnails_.end()) {
|
||||||
// callback may be called just before the thumbnail upload was cancelled
|
// callback may be called just before the thumbnail upload was canceled
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8752,7 +8752,7 @@ void MessagesManager::on_upload_thumbnail(FileId thumbnail_file_id,
|
|||||||
Message *m = get_message(full_message_id);
|
Message *m = get_message(full_message_id);
|
||||||
if (m == nullptr) {
|
if (m == nullptr) {
|
||||||
// message has already been deleted by the user or sent to inaccessible channel, do not need to send or edit it
|
// message has already been deleted by the user or sent to inaccessible channel, do not need to send or edit it
|
||||||
// thumbnail file upload should be already cancelled in cancel_send_message_query
|
// thumbnail file upload should be already canceled in cancel_send_message_query
|
||||||
LOG(ERROR) << "Message with a media has already been deleted";
|
LOG(ERROR) << "Message with a media has already been deleted";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -24782,7 +24782,7 @@ void MessagesManager::edit_message_media(FullMessageId full_message_id,
|
|||||||
return promise.set_error(r_new_reply_markup.move_as_error());
|
return promise.set_error(r_new_reply_markup.move_as_error());
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel_edit_message_media(dialog_id, m, "Cancelled by new editMessageMedia request");
|
cancel_edit_message_media(dialog_id, m, "Canceled by new editMessageMedia request");
|
||||||
|
|
||||||
m->edited_content =
|
m->edited_content =
|
||||||
dup_message_content(td_, dialog_id, content.content.get(), MessageContentDupType::Send, MessageCopyOptions());
|
dup_message_content(td_, dialog_id, content.content.get(), MessageContentDupType::Send, MessageCopyOptions());
|
||||||
@ -28580,7 +28580,7 @@ void MessagesManager::on_send_message_fail(int64 random_id, Status error) {
|
|||||||
if (it == being_sent_messages_.end()) {
|
if (it == being_sent_messages_.end()) {
|
||||||
// we can't receive fail more than once
|
// we can't receive fail more than once
|
||||||
// but message can be successfully sent before
|
// but message can be successfully sent before
|
||||||
if (error.code() != NetQuery::Cancelled) {
|
if (error.code() != NetQuery::Canceled) {
|
||||||
LOG(ERROR) << "Receive error " << error << " about successfully sent message with random_id = " << random_id;
|
LOG(ERROR) << "Receive error " << error << " about successfully sent message with random_id = " << random_id;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -28598,7 +28598,7 @@ void MessagesManager::on_send_message_fail(int64 random_id, Status error) {
|
|||||||
LOG(INFO) << "Fail to send already deleted by the user or sent to inaccessible chat " << full_message_id;
|
LOG(INFO) << "Fail to send already deleted by the user or sent to inaccessible chat " << full_message_id;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LOG_IF(ERROR, error.code() == NetQuery::Cancelled)
|
LOG_IF(ERROR, error.code() == NetQuery::Canceled)
|
||||||
<< "Receive error " << error << " about sent message with random_id = " << random_id;
|
<< "Receive error " << error << " about sent message with random_id = " << random_id;
|
||||||
|
|
||||||
auto dialog_id = full_message_id.get_dialog_id();
|
auto dialog_id = full_message_id.get_dialog_id();
|
||||||
|
@ -361,7 +361,7 @@ void StorageManager::timeout_expired() {
|
|||||||
next_gc_at_ = 0;
|
next_gc_at_ = 0;
|
||||||
run_gc({}, false, PromiseCreator::lambda([actor_id = actor_id(this)](Result<FileStats> r_stats) {
|
run_gc({}, false, PromiseCreator::lambda([actor_id = actor_id(this)](Result<FileStats> r_stats) {
|
||||||
if (!r_stats.is_error() || r_stats.error().code() != 500) {
|
if (!r_stats.is_error() || r_stats.error().code() != 500) {
|
||||||
// do not save gc timestamp if request was cancelled
|
// do not save gc timestamp if request was canceled
|
||||||
send_closure(actor_id, &StorageManager::save_last_gc_timestamp);
|
send_closure(actor_id, &StorageManager::save_last_gc_timestamp);
|
||||||
}
|
}
|
||||||
send_closure(actor_id, &StorageManager::schedule_next_gc);
|
send_closure(actor_id, &StorageManager::schedule_next_gc);
|
||||||
|
@ -402,7 +402,7 @@ class UpdateStatusQuery : public Td::ResultHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_error(uint64 id, Status status) override {
|
void on_error(uint64 id, Status status) override {
|
||||||
if (status.code() != NetQuery::Cancelled && !G()->is_expected_error(status)) {
|
if (status.code() != NetQuery::Canceled && !G()->is_expected_error(status)) {
|
||||||
LOG(ERROR) << "Receive error for UpdateStatusQuery: " << status;
|
LOG(ERROR) << "Receive error for UpdateStatusQuery: " << status;
|
||||||
}
|
}
|
||||||
status.ignore();
|
status.ignore();
|
||||||
@ -6599,7 +6599,7 @@ void Td::on_request(uint64 id, const td_api::downloadFile &request) {
|
|||||||
// we can't have two pending requests with different offset and limit, so cancel all previous requests
|
// we can't have two pending requests with different offset and limit, so cancel all previous requests
|
||||||
for (auto request_id : info->request_ids) {
|
for (auto request_id : info->request_ids) {
|
||||||
send_closure(actor_id(this), &Td::send_error, request_id,
|
send_closure(actor_id(this), &Td::send_error, request_id,
|
||||||
Status::Error(200, "Cancelled by another downloadFile request"));
|
Status::Error(200, "Canceled by another downloadFile request"));
|
||||||
}
|
}
|
||||||
info->request_ids.clear();
|
info->request_ids.clear();
|
||||||
}
|
}
|
||||||
@ -6639,7 +6639,7 @@ void Td::on_file_download_finished(FileId file_id) {
|
|||||||
download_offset + downloaded_size - it->second.offset >= limit))) {
|
download_offset + downloaded_size - it->second.offset >= limit))) {
|
||||||
send_result(id, std::move(file_object));
|
send_result(id, std::move(file_object));
|
||||||
} else {
|
} else {
|
||||||
send_error_impl(id, td_api::make_object<td_api::error>(400, "File download has failed or was cancelled"));
|
send_error_impl(id, td_api::make_object<td_api::error>(400, "File download has failed or was canceled"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pending_file_downloads_.erase(it);
|
pending_file_downloads_.erase(it);
|
||||||
|
@ -238,7 +238,7 @@ class MapDownloadGenerateActor : public FileGenerateActor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void hangup_shared() override {
|
void hangup_shared() override {
|
||||||
on_error(Status::Error(1, "Cancelled"));
|
on_error(Status::Error(1, "Canceled"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -308,7 +308,7 @@ class FileExternalGenerateActor : public FileGenerateActor {
|
|||||||
static_cast<int64>(query_id_), generate_location_.original_path_, path_, generate_location_.conversion_));
|
static_cast<int64>(query_id_), generate_location_.original_path_, path_, generate_location_.conversion_));
|
||||||
}
|
}
|
||||||
void hangup() override {
|
void hangup() override {
|
||||||
check_status(Status::Error(1, "Cancelled"));
|
check_status(Status::Error(1, "Canceled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
Status do_file_generate_write_part(int32 offset, const string &data) {
|
Status do_file_generate_write_part(int32 offset, const string &data) {
|
||||||
|
@ -142,7 +142,7 @@ void FileLoadManager::cancel(QueryId id) {
|
|||||||
if (it == query_id_to_node_id_.end()) {
|
if (it == query_id_to_node_id_.end()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
on_error_impl(it->second, Status::Error(1, "Cancelled"));
|
on_error_impl(it->second, Status::Error(1, "Canceled"));
|
||||||
}
|
}
|
||||||
void FileLoadManager::update_local_file_location(QueryId id, const LocalFileLocation &local) {
|
void FileLoadManager::update_local_file_location(QueryId id, const LocalFileLocation &local) {
|
||||||
if (stop_flag_) {
|
if (stop_flag_) {
|
||||||
@ -283,7 +283,7 @@ void FileLoadManager::on_error_impl(NodeId node_id, Status status) {
|
|||||||
|
|
||||||
void FileLoadManager::hangup_shared() {
|
void FileLoadManager::hangup_shared() {
|
||||||
auto node_id = get_link_token();
|
auto node_id = get_link_token();
|
||||||
on_error_impl(node_id, Status::Error(1, "Cancelled"));
|
on_error_impl(node_id, Status::Error(1, "Canceled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileLoadManager::loop() {
|
void FileLoadManager::loop() {
|
||||||
|
@ -278,7 +278,7 @@ void FileLoader::on_result(NetQueryPtr query) {
|
|||||||
bool next = false;
|
bool next = false;
|
||||||
auto status = [&] {
|
auto status = [&] {
|
||||||
TRY_RESULT(should_restart, should_restart_part(part, query));
|
TRY_RESULT(should_restart, should_restart_part(part, query));
|
||||||
if (query->is_error() && query->error().code() == NetQuery::Error::Cancelled) {
|
if (query->is_error() && query->error().code() == NetQuery::Error::Canceled) {
|
||||||
should_restart = true;
|
should_restart = true;
|
||||||
}
|
}
|
||||||
if (should_restart) {
|
if (should_restart) {
|
||||||
|
@ -2179,7 +2179,7 @@ void FileManager::download(FileId file_id, std::shared_ptr<DownloadCallback> cal
|
|||||||
// this would be an error and should never happen, unless we cancel previous download query
|
// this would be an error and should never happen, unless we cancel previous download query
|
||||||
// in that case we send an error to the callback
|
// in that case we send an error to the callback
|
||||||
CHECK(new_priority == 0);
|
CHECK(new_priority == 0);
|
||||||
file_info->download_callback_->on_download_error(file_id, Status::Error(200, "Cancelled"));
|
file_info->download_callback_->on_download_error(file_id, Status::Error(200, "Canceled"));
|
||||||
}
|
}
|
||||||
file_info->download_priority_ = narrow_cast<int8>(new_priority);
|
file_info->download_priority_ = narrow_cast<int8>(new_priority);
|
||||||
file_info->download_callback_ = std::move(callback);
|
file_info->download_callback_ = std::move(callback);
|
||||||
@ -2367,7 +2367,7 @@ class FileManager::ForceUploadActor : public Actor {
|
|||||||
if (callback_.empty()) {
|
if (callback_.empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
send_closure(std::move(callback_), &ForceUploadActor::on_upload_error, Status::Error("Cancelled"));
|
send_closure(std::move(callback_), &ForceUploadActor::on_upload_error, Status::Error("Canceled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -2445,7 +2445,7 @@ class FileManager::ForceUploadActor : public Actor {
|
|||||||
|
|
||||||
void tear_down() override {
|
void tear_down() override {
|
||||||
if (callback_) {
|
if (callback_) {
|
||||||
callback_->on_upload_error(file_id_, Status::Error("Cancelled"));
|
callback_->on_upload_error(file_id_, Status::Error("Canceled"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -857,7 +857,7 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
|
|||||||
auto begin = client.queries.begin();
|
auto begin = client.queries.begin();
|
||||||
auto it = begin;
|
auto it = begin;
|
||||||
while (it != client.queries.end() && !client.ready_connections.empty()) {
|
while (it != client.queries.end() && !client.ready_connections.empty()) {
|
||||||
if (!it->is_cancelled()) {
|
if (!it->is_canceled()) {
|
||||||
VLOG(connections) << "Send to promise " << tag("connection", client.ready_connections.back().first.get());
|
VLOG(connections) << "Send to promise " << tag("connection", client.ready_connections.back().first.get());
|
||||||
it->set_value(std::move(client.ready_connections.back().first));
|
it->set_value(std::move(client.ready_connections.back().first));
|
||||||
client.ready_connections.pop_back();
|
client.ready_connections.pop_back();
|
||||||
|
@ -44,8 +44,7 @@ int32 NetQuery::tl_magic(const BufferSlice &buffer_slice) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void NetQuery::set_error(Status status, string source) {
|
void NetQuery::set_error(Status status, string source) {
|
||||||
if (status.code() == Error::Resend || status.code() == Error::Cancelled ||
|
if (status.code() == Error::Resend || status.code() == Error::Canceled || status.code() == Error::ResendInvokeAfter) {
|
||||||
status.code() == Error::ResendInvokeAfter) {
|
|
||||||
return set_error_impl(Status::Error(200, PSLICE() << status), std::move(source));
|
return set_error_impl(Status::Error(200, PSLICE() << status), std::move(source));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class NetQuery : public TsListNode<NetQueryDebug> {
|
|||||||
enum class Type : int8 { Common, Upload, Download, DownloadSmall };
|
enum class Type : int8 { Common, Upload, Download, DownloadSmall };
|
||||||
enum class AuthFlag : int8 { Off, On };
|
enum class AuthFlag : int8 { Off, On };
|
||||||
enum class GzipFlag : int8 { Off, On };
|
enum class GzipFlag : int8 { Off, On };
|
||||||
enum Error : int32 { Resend = 202, Cancelled = 203, ResendInvokeAfter = 204 };
|
enum Error : int32 { Resend = 202, Canceled = 203, ResendInvokeAfter = 204 };
|
||||||
|
|
||||||
uint64 id() const {
|
uint64 id() const {
|
||||||
return id_;
|
return id_;
|
||||||
@ -143,8 +143,8 @@ class NetQuery : public TsListNode<NetQueryDebug> {
|
|||||||
set_error_impl(Status::Error<Error::Resend>());
|
set_error_impl(Status::Error<Error::Resend>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_error_cancelled() {
|
void set_error_canceled() {
|
||||||
set_error_impl(Status::Error<Error::Cancelled>());
|
set_error_impl(Status::Error<Error::Canceled>());
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_error_resend_invoke_after() {
|
void set_error_resend_invoke_after() {
|
||||||
@ -154,7 +154,7 @@ class NetQuery : public TsListNode<NetQueryDebug> {
|
|||||||
bool update_is_ready() {
|
bool update_is_ready() {
|
||||||
if (state_ == State::Query) {
|
if (state_ == State::Query) {
|
||||||
if (cancellation_token_.load(std::memory_order_relaxed) == 0 || cancel_slot_.was_signal()) {
|
if (cancellation_token_.load(std::memory_order_relaxed) == 0 || cancel_slot_.was_signal()) {
|
||||||
set_error_cancelled();
|
set_error_canceled();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -94,10 +94,10 @@ class GenAuthKeyActor : public Actor {
|
|||||||
|
|
||||||
void hangup() override {
|
void hangup() override {
|
||||||
if (connection_promise_) {
|
if (connection_promise_) {
|
||||||
connection_promise_.set_error(Status::Error(1, "Cancelled"));
|
connection_promise_.set_error(Status::Error(1, "Canceled"));
|
||||||
}
|
}
|
||||||
if (handshake_promise_) {
|
if (handshake_promise_) {
|
||||||
handshake_promise_.set_error(Status::Error(1, "Cancelled"));
|
handshake_promise_.set_error(Status::Error(1, "Canceled"));
|
||||||
}
|
}
|
||||||
stop();
|
stop();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class PromiseInterface {
|
|||||||
virtual bool is_cancellable() const {
|
virtual bool is_cancellable() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
virtual bool is_cancelled() const {
|
virtual bool is_canceled() const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,11 +296,11 @@ class Promise {
|
|||||||
}
|
}
|
||||||
return promise_->is_cancellable();
|
return promise_->is_cancellable();
|
||||||
}
|
}
|
||||||
bool is_cancelled() const {
|
bool is_canceled() const {
|
||||||
if (!promise_) {
|
if (!promise_) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return promise_->is_cancelled();
|
return promise_->is_canceled();
|
||||||
}
|
}
|
||||||
unique_ptr<PromiseInterface<T>> release() {
|
unique_ptr<PromiseInterface<T>> release() {
|
||||||
return std::move(promise_);
|
return std::move(promise_);
|
||||||
@ -416,7 +416,7 @@ class CancellablePromise : public PromiseT {
|
|||||||
virtual bool is_cancellable() const {
|
virtual bool is_cancellable() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual bool is_cancelled() const {
|
virtual bool is_canceled() const {
|
||||||
return static_cast<bool>(cancellation_token_);
|
return static_cast<bool>(cancellation_token_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void TransparentProxy::tear_down() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TransparentProxy::hangup() {
|
void TransparentProxy::hangup() {
|
||||||
on_error(Status::Error("Cancelled"));
|
on_error(Status::Error("Canceled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransparentProxy::start_up() {
|
void TransparentProxy::start_up() {
|
||||||
|
@ -149,7 +149,7 @@ void Wget::timeout_expired() {
|
|||||||
|
|
||||||
void Wget::tear_down() {
|
void Wget::tear_down() {
|
||||||
if (promise_) {
|
if (promise_) {
|
||||||
on_error(Status::Error("Cancelled"));
|
on_error(Status::Error("Canceled"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,18 +13,18 @@ namespace td {
|
|||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
struct RawCancellationToken {
|
struct RawCancellationToken {
|
||||||
std::atomic<bool> is_cancelled_{false};
|
std::atomic<bool> is_canceled_{false};
|
||||||
};
|
};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
class CancellationToken {
|
class CancellationToken {
|
||||||
public:
|
public:
|
||||||
explicit operator bool() const {
|
explicit operator bool() const {
|
||||||
// empty CancellationToken is never cancelled
|
// empty CancellationToken is never canceled
|
||||||
if (!token_) {
|
if (!token_) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return token_->is_cancelled_.load(std::memory_order_acquire);
|
return token_->is_canceled_.load(std::memory_order_acquire);
|
||||||
}
|
}
|
||||||
CancellationToken() = default;
|
CancellationToken() = default;
|
||||||
explicit CancellationToken(std::shared_ptr<detail::RawCancellationToken> token) : token_(std::move(token)) {
|
explicit CancellationToken(std::shared_ptr<detail::RawCancellationToken> token) : token_(std::move(token)) {
|
||||||
@ -60,7 +60,7 @@ class CancellationTokenSource {
|
|||||||
if (!token_) {
|
if (!token_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
token_->is_cancelled_.store(true, std::memory_order_release);
|
token_->is_canceled_.store(true, std::memory_order_release);
|
||||||
token_.reset();
|
token_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user