diff --git a/repertory/librepertory/include/file_manager/ring_buffer_open_file.hpp b/repertory/librepertory/include/file_manager/ring_buffer_open_file.hpp index 38b4f6aa..29f92028 100644 --- a/repertory/librepertory/include/file_manager/ring_buffer_open_file.hpp +++ b/repertory/librepertory/include/file_manager/ring_buffer_open_file.hpp @@ -67,6 +67,8 @@ private: private: void background_reader_thread(); + [[nodiscard]] auto check_allocation() -> api_error; + auto download_chunk(std::size_t chunk, bool skip_active) -> api_error; public: diff --git a/repertory/librepertory/src/file_manager/ring_buffer_open_file.cpp b/repertory/librepertory/src/file_manager/ring_buffer_open_file.cpp index 132a13a8..8f26360b 100644 --- a/repertory/librepertory/src/file_manager/ring_buffer_open_file.cpp +++ b/repertory/librepertory/src/file_manager/ring_buffer_open_file.cpp @@ -87,15 +87,19 @@ ring_buffer_open_file::~ring_buffer_open_file() { close(); - nf_->close(); - if (not utils::file::file(source_path_).remove()) { - utils::error::raise_api_path_error( - function_name, fsi_.api_path, source_path_, - utils::get_last_error_code(), "failed to delete file"); + if (nf_) { + nf_->close(); + if (not utils::file::file(source_path_).remove()) { + utils::error::raise_api_path_error( + function_name, fsi_.api_path, source_path_, + utils::get_last_error_code(), "failed to delete file"); + } } - reader_thread_->join(); - reader_thread_.reset(); + if (reader_thread_) { + reader_thread_->join(); + reader_thread_.reset(); + } } void ring_buffer_open_file::background_reader_thread() { @@ -148,6 +152,10 @@ auto ring_buffer_open_file::can_handle_file(std::uint64_t file_size, return file_size >= (static_cast(ring_size) * chunk_size); } +auto ring_buffer_open_file::check_allocation() -> api_error { + +} + auto ring_buffer_open_file::close() -> bool { stop_requested_ = true;