Try fix race

This commit is contained in:
kssenii 2024-11-15 15:53:25 +01:00
parent 8c1dee30a9
commit 2a5385b4a0

View File

@ -321,8 +321,10 @@ void FileSegment::resetRemoteFileReader()
FileSegment::RemoteFileReaderPtr FileSegment::extractRemoteFileReader() FileSegment::RemoteFileReaderPtr FileSegment::extractRemoteFileReader()
{ {
auto lk = lock(); auto lk = lock();
if (remote_file_reader && (download_state == State::DOWNLOADED if (remote_file_reader
|| download_state == State::PARTIALLY_DOWNLOADED_NO_CONTINUATION)) && remote_file_reader.unique()
&& (download_state == State::DOWNLOADED
|| download_state == State::PARTIALLY_DOWNLOADED_NO_CONTINUATION))
{ {
return std::move(remote_file_reader); return std::move(remote_file_reader);
} }