Minor improvements.
This commit is contained in:
parent
99a1b6fff9
commit
c9bd5d3651
@ -401,7 +401,7 @@ class DownloadManagerImpl final : public DownloadManager {
|
|||||||
<< " with is_paused = " << file_info->is_paused;
|
<< " with is_paused = " << file_info->is_paused;
|
||||||
auto it = files_.emplace(download_id, std::move(file_info)).first;
|
auto it = files_.emplace(download_id, std::move(file_info)).first;
|
||||||
register_file_info(*it->second);
|
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);
|
callback_->start_file(it->second->internal_file_id, it->second->priority, it->second->link_token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4027,13 +4027,14 @@ void Td::init_managers() {
|
|||||||
void on_download_ok(FileId file_id) final {
|
void on_download_ok(FileId file_id) final {
|
||||||
send_update(file_id, true);
|
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);
|
send_update(file_id, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ActorShared<DownloadManager> download_manager_;
|
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 td = G()->td().get_actor_unsafe();
|
||||||
auto file_view = td->file_manager_->get_file_view(file_id);
|
auto file_view = td->file_manager_->get_file_view(file_id);
|
||||||
send_closure(download_manager_, &DownloadManager::update_file_download_state, file_id,
|
send_closure(download_manager_, &DownloadManager::update_file_download_state, file_id,
|
||||||
|
@ -3915,6 +3915,7 @@ void FileManager::hangup() {
|
|||||||
void FileManager::tear_down() {
|
void FileManager::tear_down() {
|
||||||
parent_.reset();
|
parent_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int64 FileManager::KEEP_DOWNLOAD_LIMIT;
|
constexpr int64 FileManager::KEEP_DOWNLOAD_LIMIT;
|
||||||
constexpr int64 FileManager::KEEP_DOWNLOAD_OFFSET;
|
constexpr int64 FileManager::KEEP_DOWNLOAD_OFFSET;
|
||||||
constexpr int64 FileManager::IGNORE_DOWNLOAD_LIMIT;
|
constexpr int64 FileManager::IGNORE_DOWNLOAD_LIMIT;
|
||||||
|
Loading…
Reference in New Issue
Block a user