This commit is contained in:
2024-12-28 08:25:02 -06:00
parent b312fa7795
commit f63175626e

View File

@@ -93,12 +93,12 @@ auto direct_open_file::download_chunk(std::size_t chunk,
return unlock_and_return(api_error::invalid_ring_buffer_position);
}
if (active_downloads_.find(chunk) != active_downloads_.end()) {
if (get_active_downloads().find(chunk) != get_active_downloads().end()) {
if (skip_active) {
return unlock_and_return(api_error::success);
}
auto active_download = active_downloads_.at(chunk);
auto active_download = get_active_downloads().at(chunk);
unlock_and_notify();
return active_download->wait();
@@ -109,7 +109,7 @@ auto direct_open_file::download_chunk(std::size_t chunk,
}
auto active_download{std::make_shared<download>()};
active_downloads_[chunk] = active_download;
get_active_downloads()[chunk] = active_download;
auto &buffer = ring_data_.at(chunk % ring_state_.size());
auto data_offset{chunk * get_chunk_size()};
@@ -131,7 +131,7 @@ auto direct_open_file::download_chunk(std::size_t chunk,
progress);
}
active_downloads_.erase(chunk);
get_active_downloads().erase(chunk);
unlock_and_notify();
active_download->notify(res);