From f730830154a0ce93df656fb65c8dd77b202a43eb Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 16 Jul 2024 14:18:29 +0300 Subject: [PATCH] Rename loop() to try_stop(). --- td/telegram/files/FileDownloadManager.cpp | 6 +++--- td/telegram/files/FileDownloadManager.h | 4 +++- td/telegram/files/FileUploadManager.cpp | 6 +++--- td/telegram/files/FileUploadManager.h | 3 ++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/td/telegram/files/FileDownloadManager.cpp b/td/telegram/files/FileDownloadManager.cpp index 39d5ec34f..22ce2025a 100644 --- a/td/telegram/files/FileDownloadManager.cpp +++ b/td/telegram/files/FileDownloadManager.cpp @@ -127,7 +127,7 @@ void FileDownloadManager::hangup() { node.from_bytes_.reset(); }); stop_flag_ = true; - loop(); + try_stop(); } void FileDownloadManager::on_start_download() { @@ -186,7 +186,7 @@ void FileDownloadManager::hangup_shared() { on_error_impl(node_id, Status::Error(-1, "Canceled")); } -void FileDownloadManager::loop() { +void FileDownloadManager::try_stop() { if (stop_flag_ && nodes_container_.empty()) { stop(); } @@ -197,7 +197,7 @@ void FileDownloadManager::close_node(NodeId node_id) { CHECK(node); query_id_to_node_id_.erase(node->query_id_); nodes_container_.erase(node_id); - loop(); + try_stop(); } } // namespace td diff --git a/td/telegram/files/FileDownloadManager.h b/td/telegram/files/FileDownloadManager.h index 8059e60ec..e10527992 100644 --- a/td/telegram/files/FileDownloadManager.h +++ b/td/telegram/files/FileDownloadManager.h @@ -72,11 +72,13 @@ class FileDownloadManager final : public Actor { bool stop_flag_ = false; void start_up() final; - void loop() final; void hangup() final; void hangup_shared() final; void close_node(NodeId node_id); + + void try_stop(); + ActorOwn &get_download_resource_manager(bool is_small, DcId dc_id); void on_start_download(); diff --git a/td/telegram/files/FileUploadManager.cpp b/td/telegram/files/FileUploadManager.cpp index 0ec94b4a5..c2399b7bf 100644 --- a/td/telegram/files/FileUploadManager.cpp +++ b/td/telegram/files/FileUploadManager.cpp @@ -112,7 +112,7 @@ void FileUploadManager::hangup() { node.hash_uploader_.reset(); }); stop_flag_ = true; - loop(); + try_stop(); } void FileUploadManager::on_hash(string hash) { @@ -183,7 +183,7 @@ void FileUploadManager::hangup_shared() { on_error_impl(node_id, Status::Error(-1, "Canceled")); } -void FileUploadManager::loop() { +void FileUploadManager::try_stop() { if (stop_flag_ && nodes_container_.empty()) { stop(); } @@ -194,7 +194,7 @@ void FileUploadManager::close_node(NodeId node_id) { CHECK(node); query_id_to_node_id_.erase(node->query_id_); nodes_container_.erase(node_id); - loop(); + try_stop(); } } // namespace td diff --git a/td/telegram/files/FileUploadManager.h b/td/telegram/files/FileUploadManager.h index 71cb8e278..8ef9a9141 100644 --- a/td/telegram/files/FileUploadManager.h +++ b/td/telegram/files/FileUploadManager.h @@ -67,12 +67,13 @@ class FileUploadManager final : public Actor { bool stop_flag_ = false; void start_up() final; - void loop() final; void hangup() final; void hangup_shared() final; void close_node(NodeId node_id); + void try_stop(); + void on_partial_upload(PartialRemoteFileLocation partial_remote, int64 ready_size); void on_hash(string hash); void on_ok_upload(FileType file_type, PartialRemoteFileLocation remote, int64 size);