Commit 541468f0 authored by Max Kellermann's avatar Max Kellermann

input/async: check for errors in Seek()

Fixes a busy loop in BufferingInputStream::RunThreadLocked() because the method never learns that seeking is ignored, even though the HTTP stream is already broken and can never be read; nobody cared to check for errors. Closes https://github.com/MusicPlayerDaemon/MPD/issues/1727
parent d2797eff
ver 0.23.13 (not yet released)
* input
- curl: fix busy loop after connection failed
ver 0.23.12 (2023/01/17)
* input
......
......@@ -101,9 +101,17 @@ AsyncInputStream::Seek(std::unique_lock<Mutex> &lock,
assert(IsReady());
assert(seek_state == SeekState::NONE);
if (new_offset == offset)
/* no-op */
if (new_offset == offset) {
/* no-op, but if the stream is not open anymore (maybe
because it has failed), nothing can be read, so we
should check for errors here instead of pretending
everything's fine */
if (!open)
Check();
return;
}
if (!IsSeekable())
throw std::runtime_error("Not seekable");
......
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