diff --git a/src/input/AsyncInputStream.cxx b/src/input/AsyncInputStream.cxx index d5092e42e..a3f4eb36f 100644 --- a/src/input/AsyncInputStream.cxx +++ b/src/input/AsyncInputStream.cxx @@ -24,6 +24,8 @@ #include "thread/Cond.hxx" #include "IOThread.hxx" +#include + #include #include @@ -64,16 +66,6 @@ AsyncInputStream::Pause() paused = true; } -void -AsyncInputStream::PostponeError(Error &&error) -{ - assert(io_thread_inside()); - - seek_state = SeekState::NONE; - postponed_error = std::move(error); - cond.broadcast(); -} - inline void AsyncInputStream::Resume() { @@ -87,7 +79,7 @@ AsyncInputStream::Resume() } bool -AsyncInputStream::Check(Error &error) +AsyncInputStream::Check(Error &) { if (postponed_exception) { auto e = std::move(postponed_exception); @@ -95,13 +87,7 @@ AsyncInputStream::Check(Error &error) std::rethrow_exception(e); } - bool success = !postponed_error.IsDefined(); - if (!success) { - error = std::move(postponed_error); - postponed_error.Clear(); - } - - return success; + return true; } bool @@ -121,10 +107,8 @@ AsyncInputStream::Seek(offset_type new_offset, Error &error) /* no-op */ return true; - if (!IsSeekable()) { - error.Set(input_domain, "Not seekable"); - return false; - } + if (!IsSeekable()) + throw std::runtime_error("Not seekable"); /* check if we can fast-forward the buffer */ @@ -187,8 +171,7 @@ AsyncInputStream::ReadTag() bool AsyncInputStream::IsAvailable() { - return postponed_error.IsDefined() || - postponed_exception || + return postponed_exception || IsEOF() || !buffer.IsEmpty(); } @@ -289,6 +272,7 @@ AsyncInputStream::DeferredSeek() DoSeek(seek_offset); } catch (...) { + seek_state = SeekState::NONE; postponed_exception = std::current_exception(); cond.broadcast(); } diff --git a/src/input/AsyncInputStream.hxx b/src/input/AsyncInputStream.hxx index 91eb8b3bf..6e7b427e0 100644 --- a/src/input/AsyncInputStream.hxx +++ b/src/input/AsyncInputStream.hxx @@ -24,7 +24,6 @@ #include "event/DeferredCall.hxx" #include "util/HugeAllocator.hxx" #include "util/CircularBuffer.hxx" -#include "util/Error.hxx" #include @@ -67,8 +66,6 @@ class AsyncInputStream : public InputStream { offset_type seek_offset; protected: - Error postponed_error; - std::exception_ptr postponed_exception; public: @@ -116,11 +113,6 @@ protected: open = false; } - /** - * Pass an error from the I/O thread to the client thread. - */ - void PostponeError(Error &&error); - bool IsBufferEmpty() const { return buffer.IsEmpty(); }