diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index 2495f16a9..217311756 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -550,6 +550,7 @@ class CliClient final : public Actor { void quit() { LOG(WARNING) << "QUIT"; + close_flag_ = true; dump_memory_usage(); td_.reset(); #if TD_WINDOWS @@ -557,7 +558,6 @@ class CliClient final : public Actor { #else is_stdin_reader_stopped_ = true; #endif - close_flag_ = true; yield(); } @@ -2738,6 +2738,10 @@ class CliClient final : public Actor { } void timeout_expired() override { + if (close_flag_) { + return; + } + for (auto it = pending_file_generations.begin(); it != pending_file_generations.end();) { auto left_size = it->size - it->local_size; CHECK(left_size > 0); diff --git a/td/telegram/files/FileGenerateManager.cpp b/td/telegram/files/FileGenerateManager.cpp index cc408400c..5b7588ecf 100644 --- a/td/telegram/files/FileGenerateManager.cpp +++ b/td/telegram/files/FileGenerateManager.cpp @@ -141,6 +141,7 @@ class FileExternalGenerateActor : public FileGenerateActor { if (local_.type_ == LocalFileLocation::Type::Partial) { const auto &partial = local_.partial(); path_ = partial.path_; + LOG(INFO) << "Unlink partially generated file at " << path_; unlink(path_).ignore(); } else { auto r_file_path = open_temp_file(generate_location_.type_); @@ -191,6 +192,7 @@ class FileExternalGenerateActor : public FileGenerateActor { } if (status.is_error()) { + LOG(INFO) << "Unlink partially generated file at " << path_ << " because of " << status; unlink(path_).ignore(); callback_->on_error(std::move(status)); callback_.reset(); diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index e05859d19..869f69386 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -1277,7 +1277,7 @@ void FileManager::delete_file(FileId file_id, Promise promise, const char // TODO: review delete condition if (file_view.has_local_location()) { if (begins_with(file_view.local_location().path_, get_files_dir(file_view.get_type()))) { - LOG(INFO) << "Delete file " << file_id << " at " << file_view.local_location().path_; + LOG(INFO) << "Unlink file " << file_id << " at " << file_view.local_location().path_; clear_from_pmc(node); unlink(file_view.local_location().path_).ignore(); @@ -1290,6 +1290,7 @@ void FileManager::delete_file(FileId file_id, Promise promise, const char clear_from_pmc(node); } if (node->local_.type_ == LocalFileLocation::Type::Partial) { + LOG(INFO) << "Unlink partial file " << file_id << " at " << node->local_.partial().path_; unlink(node->local_.partial().path_).ignore(); node->set_local_location(LocalFileLocation(), 0); try_flush_node(node);