Minor improvements.

This commit is contained in:
levlam 2022-03-01 18:01:50 +03:00
parent 99a1b6fff9
commit c9bd5d3651
3 changed files with 5 additions and 3 deletions

View File

@ -401,7 +401,7 @@ class DownloadManagerImpl final : public DownloadManager {
<< " with is_paused = " << file_info->is_paused;
auto it = files_.emplace(download_id, std::move(file_info)).first;
register_file_info(*it->second);
if (it->second->completed_at == 0) {
if (it->second->completed_at == 0 && !it->second->is_paused) {
callback_->start_file(it->second->internal_file_id, it->second->priority, it->second->link_token);
}
}

View File

@ -4027,13 +4027,14 @@ void Td::init_managers() {
void on_download_ok(FileId file_id) final {
send_update(file_id, true);
}
void on_download_error(FileId file_id, Status error) {
void on_download_error(FileId file_id, Status error) final {
send_update(file_id, true);
}
private:
ActorShared<DownloadManager> download_manager_;
void send_update(FileId file_id, bool is_paused) {
void send_update(FileId file_id, bool is_paused) const {
auto td = G()->td().get_actor_unsafe();
auto file_view = td->file_manager_->get_file_view(file_id);
send_closure(download_manager_, &DownloadManager::update_file_download_state, file_id,

View File

@ -3915,6 +3915,7 @@ void FileManager::hangup() {
void FileManager::tear_down() {
parent_.reset();
}
constexpr int64 FileManager::KEEP_DOWNLOAD_LIMIT;
constexpr int64 FileManager::KEEP_DOWNLOAD_OFFSET;
constexpr int64 FileManager::IGNORE_DOWNLOAD_LIMIT;