aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/db/UpnpDatabasePlugin.cxx10
-rw-r--r--src/db/upnp/Discovery.cxx11
-rw-r--r--src/db/upnp/Discovery.hxx6
3 files changed, 8 insertions, 19 deletions
diff --git a/src/db/UpnpDatabasePlugin.cxx b/src/db/UpnpDatabasePlugin.cxx
index 5381b30a9..3c2ca72ff 100644
--- a/src/db/UpnpDatabasePlugin.cxx
+++ b/src/db/UpnpDatabasePlugin.cxx
@@ -163,9 +163,10 @@ UpnpDatabase::Open(Error &error)
if (!m_lib)
return false;
- m_superdir = UPnPDeviceDirectory::getTheDir();
- if (!m_superdir || !m_superdir->ok()) {
- error.Set(upnp_domain, "Discovery services startup failed");
+ m_superdir = new UPnPDeviceDirectory();
+ if (!m_superdir->ok()) {
+ error.Set(m_superdir->GetError());
+ delete m_superdir;
return false;
}
@@ -180,7 +181,8 @@ void
UpnpDatabase::Close()
{
delete m_root;
- // TBD decide what we do with the lib and superdir objects
+ delete m_superdir;
+ // TBD decide what we do with the lib object
}
void
diff --git a/src/db/upnp/Discovery.cxx b/src/db/upnp/Discovery.cxx
index 89f01df2a..97b57c89c 100644
--- a/src/db/upnp/Discovery.cxx
+++ b/src/db/upnp/Discovery.cxx
@@ -275,17 +275,6 @@ UPnPDeviceDirectory::search()
return true;
}
-UPnPDeviceDirectory *UPnPDeviceDirectory::getTheDir()
-{
- // TODO: elimate static variable
- static UPnPDeviceDirectory *theDevDir;
- if (theDevDir == nullptr)
- theDevDir = new UPnPDeviceDirectory();
- if (theDevDir && !theDevDir->ok())
- return 0;
- return theDevDir;
-}
-
bool
UPnPDeviceDirectory::getDirServices(std::vector<ContentDirectoryService> &out)
{
diff --git a/src/db/upnp/Discovery.hxx b/src/db/upnp/Discovery.hxx
index 899ac83ab..ddc7d2909 100644
--- a/src/db/upnp/Discovery.hxx
+++ b/src/db/upnp/Discovery.hxx
@@ -46,14 +46,12 @@ class UPnPDeviceDirectory {
time_t m_lastSearch;
- UPnPDeviceDirectory();
public:
+ UPnPDeviceDirectory();
+
UPnPDeviceDirectory(const UPnPDeviceDirectory &) = delete;
UPnPDeviceDirectory& operator=(const UPnPDeviceDirectory &) = delete;
- /** This class is a singleton. Get the instance here */
- static UPnPDeviceDirectory *getTheDir();
-
/** Retrieve the directory services currently seen on the network */
bool getDirServices(std::vector<ContentDirectoryService> &);