Commit 869d2150 authored by Max Kellermann's avatar Max Kellermann

input/buffering: merge "read_error" and "idle" checks in thread

parent 0cf922b2
...@@ -146,9 +146,10 @@ BufferingInputStream::RunThread() noexcept ...@@ -146,9 +146,10 @@ BufferingInputStream::RunThread() noexcept
seek = false; seek = false;
read_error = {}; read_error = {};
client_cond.notify_one(); client_cond.notify_one();
} else if (!idle && !read_error && } else if (read_error || idle) {
offset != input->GetOffset() && /* wait for client to consume the read error */
!IsAvailable()) { wake_cond.wait(lock);
} else if (offset != input->GetOffset() && !IsAvailable()) {
/* a past Seek() call was a no-op because data /* a past Seek() call was a no-op because data
was already available at that position, but was already available at that position, but
now we've reached a new position where now we've reached a new position where
...@@ -172,8 +173,7 @@ BufferingInputStream::RunThread() noexcept ...@@ -172,8 +173,7 @@ BufferingInputStream::RunThread() noexcept
client_cond.notify_one(); client_cond.notify_one();
OnBufferAvailable(); OnBufferAvailable();
} }
} else if (!idle && !read_error && } else if (input->IsAvailable() && !input->IsEOF()) {
input->IsAvailable() && !input->IsEOF()) {
const auto read_offset = input->GetOffset(); const auto read_offset = input->GetOffset();
auto w = buffer.Write(read_offset); auto w = buffer.Write(read_offset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment