fixes
This commit is contained in:
@ -273,7 +273,8 @@ auto direct_open_file::read(std::size_t read_size, std::uint64_t read_offset,
|
||||
|
||||
unique_mutex_lock read_lock(read_mtx_);
|
||||
for (std::size_t chunk = begin_chunk;
|
||||
(res == api_error::success) && (read_size > 0U); ++chunk) {
|
||||
not stop_requested_ && (res == api_error::success) && (read_size > 0U);
|
||||
++chunk) {
|
||||
if (chunk > ring_pos_) {
|
||||
forward(chunk - ring_pos_);
|
||||
} else if (chunk < ring_pos_) {
|
||||
@ -307,9 +308,10 @@ auto direct_open_file::read(std::size_t read_size, std::uint64_t read_offset,
|
||||
data.insert(data.end(), begin, end);
|
||||
|
||||
read_offset = 0U;
|
||||
read_size -= static_cast<std::uint64_t>(std::distance(begin, end));
|
||||
}
|
||||
|
||||
return res;
|
||||
return stop_requested_ ? api_error::download_stopped : res;
|
||||
}
|
||||
|
||||
void direct_open_file::set_api_path(const std::string &api_path) {
|
||||
|
@ -336,7 +336,8 @@ auto ring_buffer_open_file::read(std::size_t read_size,
|
||||
|
||||
unique_mutex_lock read_lock(read_mtx_);
|
||||
for (std::size_t chunk = begin_chunk;
|
||||
(res == api_error::success) && (read_size > 0U); ++chunk) {
|
||||
not stop_requested_ && (res == api_error::success) && (read_size > 0U);
|
||||
++chunk) {
|
||||
if (chunk > ring_pos_) {
|
||||
forward(chunk - ring_pos_);
|
||||
} else if (chunk < ring_pos_) {
|
||||
@ -389,7 +390,7 @@ auto ring_buffer_open_file::read(std::size_t read_size,
|
||||
read_offset = 0U;
|
||||
}
|
||||
|
||||
return res;
|
||||
return stop_requested_ ? api_error::download_stopped : res;
|
||||
}
|
||||
|
||||
void ring_buffer_open_file::set(std::size_t first_chunk,
|
||||
|
Reference in New Issue
Block a user