From f260f1d50abf2c8c0046f359a9a81117d246986e Mon Sep 17 00:00:00 2001 From: "Scott E. Graves" Date: Fri, 20 Dec 2024 20:57:29 -0600 Subject: [PATCH] refactor --- .../src/file_manager/open_file.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/repertory/librepertory/src/file_manager/open_file.cpp b/repertory/librepertory/src/file_manager/open_file.cpp index ccd7a090..a93ba299 100644 --- a/repertory/librepertory/src/file_manager/open_file.cpp +++ b/repertory/librepertory/src/file_manager/open_file.cpp @@ -558,17 +558,18 @@ void open_file::update_background_reader(std::size_t read_chunk) { } io_thread_notify_.notify_all(); io_lock.unlock(); - } else { - do { - 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())); - - file_lock.unlock(); - download_chunk(next_chunk, true, false); + continue; } + + do { + 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())); + + file_lock.unlock(); + download_chunk(next_chunk, true, false); } }); }