Prefer US spelling of "canceled".

This commit is contained in:
levlam 2021-05-31 21:51:48 +03:00
parent 181e48685e
commit 9cecc116f3
23 changed files with 55 additions and 56 deletions

View File

@ -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
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;
@ -2028,7 +2028,7 @@ chatActionStartPlayingGame = ChatAction;
chatActionRecordingVideoNote = ChatAction;
//@description The user is uploading a video note @progress Upload progress, as a percentage
chatActionUploadingVideoNote progress:int32 = ChatAction;
//@description The user has cancelled the previous action
//@description The user has canceled the previous action
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
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;
//@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
//@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
//@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
//-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;
//@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

View File

@ -27,7 +27,7 @@ HandshakeActor::HandshakeActor(unique_ptr<AuthKeyHandshake> handshake, unique_pt
}
void HandshakeActor::close() {
finish(Status::Error("Cancelled"));
finish(Status::Error("Canceled"));
stop();
}

View File

@ -40,7 +40,7 @@ class HandshakeActor : public Actor {
finish(Status::OK());
}
void hangup() override {
finish(Status::Error(1, "Cancelled"));
finish(Status::Error(1, "Canceled"));
stop();
}
void timeout_expired() override {

View File

@ -45,7 +45,7 @@ ActorOwn<> create_ping_actor(string debug, unique_ptr<RawConnection> raw_connect
}
void hangup() override {
finish(Status::Error("Cancelled"));
finish(Status::Error("Canceled"));
stop();
}

View File

@ -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) {
return true;
}

View File

@ -56,7 +56,7 @@ class DialogAction {
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);

View File

@ -2236,7 +2236,7 @@ int32 GroupCallManager::cancel_join_group_call_request(InputGroupCallId input_gr
if (!it->second->query_ref.empty()) {
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;
pending_join_requests_.erase(it);
return audio_source;
@ -2252,7 +2252,7 @@ int32 GroupCallManager::cancel_join_group_call_presentation_request(InputGroupCa
if (!it->second->query_ref.empty()) {
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;
pending_join_presentation_requests_.erase(it);
return audio_source;

View File

@ -104,8 +104,8 @@ class GetInlineBotResultsQuery : public Td::ResultHandler {
}
void on_error(uint64 id, Status status) override {
if (status.code() == NetQuery::Cancelled) {
status = Status::Error(406, "Request cancelled");
if (status.code() == NetQuery::Canceled) {
status = Status::Error(406, "Request canceled");
} else if (status.message() == "BOT_RESPONSE_TIMEOUT") {
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;
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_->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{

View File

@ -3854,7 +3854,7 @@ class SetTypingQuery : public Td::ResultHandler {
}
void on_error(uint64 id, Status status) override {
if (status.code() == NetQuery::Cancelled) {
if (status.code() == NetQuery::Canceled) {
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) &&
!it->action.is_cancelled_by_message_of_type(message_content_type)) {
!it->action.is_canceled_by_message_of_type(message_content_type)) {
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);
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;
}
@ -8555,7 +8555,7 @@ void MessagesManager::on_upload_media(FileId file_id, tl_object_ptr<telegram_api
Message *m = get_message(full_message_id);
if (m == nullptr) {
// 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";
return;
}
@ -8665,7 +8665,7 @@ void MessagesManager::on_upload_media_error(FileId file_id, Status status) {
auto it = being_uploaded_files_.find(file_id);
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;
}
@ -8739,7 +8739,7 @@ void MessagesManager::on_upload_thumbnail(FileId thumbnail_file_id,
auto it = being_uploaded_thumbnails_.find(thumbnail_file_id);
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;
}
@ -8752,7 +8752,7 @@ void MessagesManager::on_upload_thumbnail(FileId thumbnail_file_id,
Message *m = get_message(full_message_id);
if (m == nullptr) {
// 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";
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());
}
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 =
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()) {
// we can't receive fail more than once
// 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;
}
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;
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;
auto dialog_id = full_message_id.get_dialog_id();

View File

@ -361,7 +361,7 @@ void StorageManager::timeout_expired() {
next_gc_at_ = 0;
run_gc({}, false, PromiseCreator::lambda([actor_id = actor_id(this)](Result<FileStats> r_stats) {
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::schedule_next_gc);

View File

@ -402,7 +402,7 @@ class UpdateStatusQuery : public Td::ResultHandler {
}
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;
}
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
for (auto request_id : info->request_ids) {
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();
}
@ -6639,7 +6639,7 @@ void Td::on_file_download_finished(FileId file_id) {
download_offset + downloaded_size - it->second.offset >= limit))) {
send_result(id, std::move(file_object));
} 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);

View File

@ -238,7 +238,7 @@ class MapDownloadGenerateActor : public FileGenerateActor {
}
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_));
}
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) {

View File

@ -142,7 +142,7 @@ void FileLoadManager::cancel(QueryId id) {
if (it == query_id_to_node_id_.end()) {
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) {
if (stop_flag_) {
@ -283,7 +283,7 @@ void FileLoadManager::on_error_impl(NodeId node_id, Status status) {
void FileLoadManager::hangup_shared() {
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() {

View File

@ -278,7 +278,7 @@ void FileLoader::on_result(NetQueryPtr query) {
bool next = false;
auto status = [&] {
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;
}
if (should_restart) {

View File

@ -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
// in that case we send an error to the callback
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_callback_ = std::move(callback);
@ -2367,7 +2367,7 @@ class FileManager::ForceUploadActor : public Actor {
if (callback_.empty()) {
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:
@ -2445,7 +2445,7 @@ class FileManager::ForceUploadActor : public Actor {
void tear_down() override {
if (callback_) {
callback_->on_upload_error(file_id_, Status::Error("Cancelled"));
callback_->on_upload_error(file_id_, Status::Error("Canceled"));
}
}
};

View File

@ -857,7 +857,7 @@ void ConnectionCreator::client_loop(ClientInfo &client) {
auto begin = client.queries.begin();
auto it = begin;
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());
it->set_value(std::move(client.ready_connections.back().first));
client.ready_connections.pop_back();

View File

@ -44,8 +44,7 @@ int32 NetQuery::tl_magic(const BufferSlice &buffer_slice) {
}
void NetQuery::set_error(Status status, string source) {
if (status.code() == Error::Resend || status.code() == Error::Cancelled ||
status.code() == Error::ResendInvokeAfter) {
if (status.code() == Error::Resend || status.code() == Error::Canceled || status.code() == Error::ResendInvokeAfter) {
return set_error_impl(Status::Error(200, PSLICE() << status), std::move(source));
}

View File

@ -51,7 +51,7 @@ class NetQuery : public TsListNode<NetQueryDebug> {
enum class Type : int8 { Common, Upload, Download, DownloadSmall };
enum class AuthFlag : 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 {
return id_;
@ -143,8 +143,8 @@ class NetQuery : public TsListNode<NetQueryDebug> {
set_error_impl(Status::Error<Error::Resend>());
}
void set_error_cancelled() {
set_error_impl(Status::Error<Error::Cancelled>());
void set_error_canceled() {
set_error_impl(Status::Error<Error::Canceled>());
}
void set_error_resend_invoke_after() {
@ -154,7 +154,7 @@ class NetQuery : public TsListNode<NetQueryDebug> {
bool update_is_ready() {
if (state_ == State::Query) {
if (cancellation_token_.load(std::memory_order_relaxed) == 0 || cancel_slot_.was_signal()) {
set_error_cancelled();
set_error_canceled();
return true;
}
return false;

View File

@ -94,10 +94,10 @@ class GenAuthKeyActor : public Actor {
void hangup() override {
if (connection_promise_) {
connection_promise_.set_error(Status::Error(1, "Cancelled"));
connection_promise_.set_error(Status::Error(1, "Canceled"));
}
if (handshake_promise_) {
handshake_promise_.set_error(Status::Error(1, "Cancelled"));
handshake_promise_.set_error(Status::Error(1, "Canceled"));
}
stop();
}

View File

@ -56,7 +56,7 @@ class PromiseInterface {
virtual bool is_cancellable() const {
return false;
}
virtual bool is_cancelled() const {
virtual bool is_canceled() const {
return false;
}
@ -296,11 +296,11 @@ class Promise {
}
return promise_->is_cancellable();
}
bool is_cancelled() const {
bool is_canceled() const {
if (!promise_) {
return false;
}
return promise_->is_cancelled();
return promise_->is_canceled();
}
unique_ptr<PromiseInterface<T>> release() {
return std::move(promise_);
@ -416,7 +416,7 @@ class CancellablePromise : public PromiseT {
virtual bool is_cancellable() const {
return true;
}
virtual bool is_cancelled() const {
virtual bool is_canceled() const {
return static_cast<bool>(cancellation_token_);
}

View File

@ -48,7 +48,7 @@ void TransparentProxy::tear_down() {
}
void TransparentProxy::hangup() {
on_error(Status::Error("Cancelled"));
on_error(Status::Error("Canceled"));
}
void TransparentProxy::start_up() {

View File

@ -149,7 +149,7 @@ void Wget::timeout_expired() {
void Wget::tear_down() {
if (promise_) {
on_error(Status::Error("Cancelled"));
on_error(Status::Error("Canceled"));
}
}

View File

@ -13,18 +13,18 @@ namespace td {
namespace detail {
struct RawCancellationToken {
std::atomic<bool> is_cancelled_{false};
std::atomic<bool> is_canceled_{false};
};
} // namespace detail
class CancellationToken {
public:
explicit operator bool() const {
// empty CancellationToken is never cancelled
// empty CancellationToken is never canceled
if (!token_) {
return false;
}
return token_->is_cancelled_.load(std::memory_order_acquire);
return token_->is_canceled_.load(std::memory_order_acquire);
}
CancellationToken() = default;
explicit CancellationToken(std::shared_ptr<detail::RawCancellationToken> token) : token_(std::move(token)) {
@ -60,7 +60,7 @@ class CancellationTokenSource {
if (!token_) {
return;
}
token_->is_cancelled_.store(true, std::memory_order_release);
token_->is_canceled_.store(true, std::memory_order_release);
token_.reset();
}