Rename loop() to try_stop().

This commit is contained in:
levlam 2024-07-16 14:18:29 +03:00
parent b46b108060
commit f730830154
4 changed files with 11 additions and 8 deletions

View File

@ -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

View File

@ -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<ResourceManager> &get_download_resource_manager(bool is_small, DcId dc_id);
void on_start_download();

View File

@ -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

View File

@ -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);