Compare commits
2 Commits
d2928e5580
...
4a203ebf47
Author | SHA1 | Date | |
---|---|---|---|
4a203ebf47 | |||
f260f1d50a |
@ -108,13 +108,14 @@ void open_file::download_chunk(std::size_t chunk, bool skip_active,
|
||||
if ((get_api_error() == api_error::success) && (chunk < read_state_.size()) &&
|
||||
not read_state_[chunk]) {
|
||||
if (active_downloads_.find(chunk) != active_downloads_.end()) {
|
||||
if (not skip_active) {
|
||||
if (skip_active) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto active_download = active_downloads_.at(chunk);
|
||||
download_lock.unlock();
|
||||
|
||||
active_download->wait();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -558,10 +559,12 @@ void open_file::update_background_reader(std::size_t read_chunk) {
|
||||
}
|
||||
io_thread_notify_.notify_all();
|
||||
io_lock.unlock();
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
do {
|
||||
next_chunk = read_chunk_ =
|
||||
((read_chunk_ + 1U) >= read_state_.size()) ? 0U
|
||||
next_chunk = read_chunk_ = ((read_chunk_ + 1U) >= read_state_.size())
|
||||
? 0U
|
||||
: read_chunk_ + 1U;
|
||||
} while ((next_chunk != 0U) && (active_downloads_.find(next_chunk) !=
|
||||
active_downloads_.end()));
|
||||
@ -569,7 +572,6 @@ void open_file::update_background_reader(std::size_t read_chunk) {
|
||||
file_lock.unlock();
|
||||
download_chunk(next_chunk, true, false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user