db/proxy: call mpd_search_cancel() after search error

Fixes "search already in progress" errors.
This commit is contained in:
Max Kellermann 2018-04-26 19:38:57 +02:00
parent 5c4169e64e
commit 388768b3a6
2 changed files with 14 additions and 2 deletions

2
NEWS
View File

@ -1,6 +1,8 @@
ver 0.20.19 (not yet released)
* protocol
- validate absolute seek time, reject negative values
* database
- proxy: fix "search already in progress" errors
* input
- mms: fix lockup bug and a crash bug
* decoder

View File

@ -682,7 +682,7 @@ static void
SearchSongs(struct mpd_connection *connection,
const DatabaseSelection &selection,
VisitSong visit_song)
{
try {
assert(selection.recursive);
assert(visit_song);
@ -709,6 +709,11 @@ SearchSongs(struct mpd_connection *connection,
if (!mpd_response_finish(connection))
ThrowError(connection);
} catch (...) {
if (connection != nullptr)
mpd_search_cancel(connection);
throw;
}
/**
@ -758,7 +763,7 @@ ProxyDatabase::VisitUniqueTags(const DatabaseSelection &selection,
TagType tag_type,
gcc_unused tag_mask_t group_mask,
VisitTag visit_tag) const
{
try {
// TODO: eliminate the const_cast
const_cast<ProxyDatabase *>(this)->EnsureConnected();
@ -801,6 +806,11 @@ ProxyDatabase::VisitUniqueTags(const DatabaseSelection &selection,
if (!mpd_response_finish(connection))
ThrowError(connection);
} catch (...) {
if (connection != nullptr)
mpd_search_cancel(connection);
throw;
}
DatabaseStats