stable
This commit is contained in:
parent
3e5fd40195
commit
d7690f7810
|
@ -152,21 +152,7 @@ tl_object_ptr<td_api::profilePhoto> get_profile_photo_object(FileManager *file_m
|
|||
}
|
||||
|
||||
bool operator==(const ProfilePhoto &lhs, const ProfilePhoto &rhs) {
|
||||
bool location_differs = lhs.small_file_id != rhs.small_file_id || lhs.big_file_id != rhs.big_file_id;
|
||||
bool id_differs;
|
||||
if (lhs.id == -1 && rhs.id == -1) {
|
||||
// group chat photo
|
||||
id_differs = location_differs;
|
||||
} else {
|
||||
id_differs = lhs.id != rhs.id;
|
||||
}
|
||||
|
||||
if (location_differs) {
|
||||
LOG_IF(ERROR, !id_differs) << "Photo " << lhs.id << " location has changed. First profilePhoto: " << lhs
|
||||
<< ", second profilePhoto: " << rhs;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return lhs.small_file_id == rhs.small_file_id || lhs.big_file_id == rhs.big_file_id;
|
||||
}
|
||||
|
||||
bool operator!=(const ProfilePhoto &lhs, const ProfilePhoto &rhs) {
|
||||
|
|
|
@ -1398,8 +1398,6 @@ Result<FileId> FileManager::merge(FileId x_file_id, FileId y_file_id, bool no_sy
|
|||
x_node->remote_.full_source == FileLocationSource::FromServer &&
|
||||
y_node->remote_.full_source == FileLocationSource::FromServer &&
|
||||
x_node->remote_.full.value().get_dc_id() != y_node->remote_.full.value().get_dc_id()) {
|
||||
LOG(ERROR) << "File remote location was changed from " << y_node->remote_.full.value() << " to "
|
||||
<< x_node->remote_.full.value();
|
||||
}
|
||||
|
||||
bool drop_last_successful_force_reupload_time = x_node->last_successful_force_reupload_time_ <= 0 &&
|
||||
|
@ -1579,7 +1577,7 @@ Result<FileId> FileManager::merge(FileId x_file_id, FileId y_file_id, bool no_sy
|
|||
file_id_info->node_id_ = node_ids[node_i];
|
||||
send_updates_flag |= file_id_info->send_updates_flag_;
|
||||
}
|
||||
other_node = {};
|
||||
other_node = {this};
|
||||
|
||||
if (send_updates_flag) {
|
||||
// node might not changed, but other_node might changed, so we need to send update anyway
|
||||
|
@ -1815,7 +1813,7 @@ FileNode *FileManager::get_file_node_raw(FileId file_id, FileNodeId *file_node_i
|
|||
FileNodePtr FileManager::get_sync_file_node(FileId file_id) {
|
||||
auto file_node = get_file_node(file_id);
|
||||
if (!file_node) {
|
||||
return {};
|
||||
return {this};
|
||||
}
|
||||
load_from_pmc(file_node, true, true, true);
|
||||
return file_node;
|
||||
|
@ -3701,10 +3699,12 @@ void FileManager::memory_cleanup() {
|
|||
if (file_id_info_.size() > 1000 && empty_file_ids_.size() < 200) {
|
||||
auto time = std::time(nullptr);
|
||||
|
||||
for (unsigned int i = 0; i < file_id_info_.size(); i++) {
|
||||
if (time - file_id_insert_time_[i] > 60 * 1) {
|
||||
for (unsigned int i = 1; i < file_id_info_.size(); i++) {
|
||||
if (time - file_id_insert_time_[i] > 60 * 5) {
|
||||
empty_file_ids_.push_back(i);
|
||||
file_id_insert_time_[i] = INT64_MAX;
|
||||
file_nodes_[file_id_info_[i].node_id_] = nullptr;
|
||||
file_id_info_[i].node_id_ = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -187,6 +187,8 @@ class FileManager;
|
|||
class FileNodePtr {
|
||||
public:
|
||||
FileNodePtr() = default;
|
||||
FileNodePtr(FileManager *file_manager) : file_manager_(file_manager) {
|
||||
}
|
||||
FileNodePtr(FileId file_id, FileManager *file_manager) : file_id_(file_id), file_manager_(file_manager) {
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue