Do not cancel already cancelled download/upload queries.

GitOrigin-RevId: 7a601fa4370a9afd6f81271abfb63edab4f31394
This commit is contained in:
levlam 2020-08-26 12:33:48 +03:00
parent 3b4d55233c
commit 0e327efc7c

View File

@ -74,7 +74,7 @@ void FileLoader::update_downloaded_part(int64 offset, int64 limit) {
auto end_part_id = begin_part_id + td::min(max_parts, new_end_part_id - begin_part_id); auto end_part_id = begin_part_id + td::min(max_parts, new_end_part_id - begin_part_id);
VLOG(files) << "Protect parts " << begin_part_id << " ... " << end_part_id - 1; VLOG(files) << "Protect parts " << begin_part_id << " ... " << end_part_id - 1;
for (auto &it : part_map_) { for (auto &it : part_map_) {
if (!(begin_part_id <= it.second.first.id && it.second.first.id < end_part_id)) { if (!it.second.second.empty() && !(begin_part_id <= it.second.first.id && it.second.first.id < end_part_id)) {
VLOG(files) << "Cancel part " << it.second.first.id; VLOG(files) << "Cancel part " << it.second.first.id;
it.second.second.reset(); // cancel_query(it.second.second); it.second.second.reset(); // cancel_query(it.second.second);
} }