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
This commit is contained in:
parent
9ee1be6fba
commit
c30c293d6f
1
NEWS
1
NEWS
|
@ -12,6 +12,7 @@ ver 0.24 (not yet released)
|
||||||
- add option to disable archive plugins in mpd.conf
|
- add option to disable archive plugins in mpd.conf
|
||||||
* input
|
* input
|
||||||
- curl: add "connect_timeout" configuration
|
- curl: add "connect_timeout" configuration
|
||||||
|
- curl: fix busy loop after connection failed
|
||||||
* decoder
|
* decoder
|
||||||
- hybrid_dsd: remove
|
- hybrid_dsd: remove
|
||||||
- opus: implement bitrate calculation
|
- opus: implement bitrate calculation
|
||||||
|
|
|
@ -102,9 +102,17 @@ AsyncInputStream::Seek(std::unique_lock<Mutex> &lock,
|
||||||
assert(IsReady());
|
assert(IsReady());
|
||||||
assert(seek_state == SeekState::NONE);
|
assert(seek_state == SeekState::NONE);
|
||||||
|
|
||||||
if (new_offset == offset)
|
if (new_offset == offset) {
|
||||||
/* no-op */
|
/* 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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsSeekable())
|
if (!IsSeekable())
|
||||||
throw std::runtime_error("Not seekable");
|
throw std::runtime_error("Not seekable");
|
||||||
|
|
Loading…
Reference in New Issue