From f703d4fc3e55f58ad4777f45e07e5784f0699c64 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 22 Jan 2014 23:48:47 +0100 Subject: [PATCH] db/upnp: call VisitDirectory on servers, even in recursive mode --- src/db/UpnpDatabasePlugin.cxx | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/db/UpnpDatabasePlugin.cxx b/src/db/UpnpDatabasePlugin.cxx index 70b39a4d3..47d2d0dd0 100644 --- a/src/db/UpnpDatabasePlugin.cxx +++ b/src/db/UpnpDatabasePlugin.cxx @@ -677,24 +677,20 @@ UpnpDatabase::Visit(const DatabaseSelection &selection, if (!m_superdir->getDirServices(servers, error)) return false; - if (!selection.recursive) { - // If the path is empty and recursive is not set, synthetize a - // pseudo-directory from the list of servers. + for (const auto &server : servers) { if (visit_directory) { - for (auto& server : servers) { - const LightDirectory d(server.getFriendlyName(), 0); - if (!visit_directory(d, error)) - return false; - } - } - } else { - // Recursive is set: visit each server - for (auto& server : servers) { - if (!VisitServer(server, vpath, selection, - visit_directory, visit_song, visit_playlist, error)) + const LightDirectory d(server.getFriendlyName(), 0); + if (!visit_directory(d, error)) return false; } + + if (selection.recursive && + !VisitServer(server, vpath, selection, + visit_directory, visit_song, visit_playlist, + error)) + return false; } + return true; }