From 6e05d300dc4c06484461f02785762a7cf5749198 Mon Sep 17 00:00:00 2001 From: "andrew (from workstation)" Date: Fri, 22 May 2020 12:11:56 +0200 Subject: [PATCH] fixes --- td/telegram/cli.cpp | 2 ++ td/telegram/files/FileManager.cpp | 18 +++++++++--------- tdutils/td/utils/Enumerator.h | 2 -- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index c18e5923..3de8c977 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -4084,6 +4084,8 @@ class CliClient final : public Actor { } #endif + on_cmd("v0"); + while (!cmd_queue_.empty() && !close_flag_) { auto cmd = std::move(cmd_queue_.front()); cmd_queue_.pop(); diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index 10a7f3c5..a4555901 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -3743,7 +3743,7 @@ void FileManager::memory_cleanup() { if (main_node_id != 0) { auto &node = file_nodes_[main_node_id]; if (node != nullptr && ((int32) i) == node->main_file_id_.fast_get()) { - if (time - node->main_file_id_.get_time() > 60 * 5 /* MAIN FILE TTL */) { + if (time - node->main_file_id_.get_time() > 20 /* MAIN FILE TTL */) { node->main_file_id_.reset_time(); for (auto &file_id : node->file_ids_) { @@ -3838,9 +3838,9 @@ void FileManager::memory_cleanup() { while (it != file_hash_to_file_id_.end()) { auto &file = file_id_info_[it->second.fast_get()]; if (file_nodes_[file.node_id_] == nullptr) { - file_hash_to_file_id_.erase(it); + file_hash_to_file_id_.erase(it++); } else { - it++; + ++it; } } } @@ -3851,9 +3851,9 @@ void FileManager::memory_cleanup() { while (it != local_location_to_file_id_.end()) { auto &file = file_id_info_[it->second.fast_get()]; if (file_nodes_[file.node_id_] == nullptr) { - it = local_location_to_file_id_.erase(it); + it = local_location_to_file_id_.erase(it++); } else { - it++; + ++it; } } } @@ -3864,9 +3864,9 @@ void FileManager::memory_cleanup() { while (it != generate_location_to_file_id_.end()) { auto &file = file_id_info_[it->second.fast_get()]; if (file_nodes_[file.node_id_] == nullptr) { - it = generate_location_to_file_id_.erase(it); + it = generate_location_to_file_id_.erase(it++); } else { - it++; + ++it; } } } @@ -3878,10 +3878,10 @@ void FileManager::memory_cleanup() { while (it != map.end()) { auto &file = file_id_info_[it->first.file_id_.fast_get()]; if (file_nodes_[file.node_id_] == nullptr) { - map.erase(it); remote_location_info_.erase(it->second); + map.erase(it++); } else { - it++; + ++it; } } } diff --git a/tdutils/td/utils/Enumerator.h b/tdutils/td/utils/Enumerator.h index 09dab775..2e412278 100644 --- a/tdutils/td/utils/Enumerator.h +++ b/tdutils/td/utils/Enumerator.h @@ -34,9 +34,7 @@ class Enumerator { } void erase(Key key_y) { - auto pos_y = static_cast(key_y - 1); empty_id_.push_back(key_y); - arr_[pos_y] = nullptr; } Key add(ValueT v) {