diff options
author | Max Kellermann <max@duempel.org> | 2014-01-16 09:06:01 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-16 09:30:24 +0100 |
commit | a35c7bc81aec11e9720462d8258a0d3c41e2fac7 (patch) | |
tree | f9601aa14c2c12fcfa183d8da248c04f8f55a915 /src/db/upnp/Discovery.cxx | |
parent | 02769929b31479bffa3e42c101a9bb192c07976f (diff) | |
download | mpd-a35c7bc81aec11e9720462d8258a0d3c41e2fac7.tar.gz mpd-a35c7bc81aec11e9720462d8258a0d3c41e2fac7.tar.xz mpd-a35c7bc81aec11e9720462d8258a0d3c41e2fac7.zip |
db/upnp: move the LibUPnP instance to class UpnpDatabase
Delete the object when closing the database.
Diffstat (limited to 'src/db/upnp/Discovery.cxx')
-rw-r--r-- | src/db/upnp/Discovery.cxx | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/db/upnp/Discovery.cxx b/src/db/upnp/Discovery.cxx index 2824d4b56..a51b57a48 100644 --- a/src/db/upnp/Discovery.cxx +++ b/src/db/upnp/Discovery.cxx @@ -216,18 +216,14 @@ UPnPDeviceDirectory::expireDevices() search(); } -UPnPDeviceDirectory::UPnPDeviceDirectory() - :m_searchTimeout(2), m_lastSearch(0) +UPnPDeviceDirectory::UPnPDeviceDirectory(LibUPnP *_lib) + :lib(_lib), m_searchTimeout(2), m_lastSearch(0) { if (!discoveredQueue.start(1, discoExplorer, 0)) { error.Set(upnp_domain, "Discover work queue start failed"); return; } - LibUPnP *lib = LibUPnP::getLibUPnP(error); - if (lib == nullptr) - return; - lib->SetHandler([](Upnp_EventType type, void *event){ cluCallBack(type, event); }); @@ -243,10 +239,6 @@ UPnPDeviceDirectory::search() return true; m_lastSearch = now; - LibUPnP *lib = LibUPnP::getLibUPnP(error); - if (lib == nullptr) - return false; - // We search both for device and service just in case. int code = UpnpSearchAsync(lib->getclh(), m_searchTimeout, ContentDirectorySType, lib); |