summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-04-26 19:38:57 +0200
committerMax Kellermann <max@musicpd.org>2018-04-26 19:41:19 +0200
commit388768b3a65c8b9264070090480c948663d746e8 (patch)
treecdf4e6dd50687ba63b37c84f28ceb41fae7168fa /src
parent5c4169e64e8b6b86ebc7ca2de260e075fdf27f5f (diff)
db/proxy: call mpd_search_cancel() after search error
Fixes "search already in progress" errors.
Diffstat (limited to 'src')
-rw-r--r--src/db/plugins/ProxyDatabasePlugin.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/db/plugins/ProxyDatabasePlugin.cxx b/src/db/plugins/ProxyDatabasePlugin.cxx
index 13f174024..9b5da1dd9 100644
--- a/src/db/plugins/ProxyDatabasePlugin.cxx
+++ b/src/db/plugins/ProxyDatabasePlugin.cxx
@@ -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