diff options
author | Max Kellermann <max@duempel.org> | 2015-02-03 23:48:11 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-02-03 23:48:11 +0100 |
commit | 833ec3d3cdb206dc41420e067874e355569bd225 (patch) | |
tree | d595a741af13803f8338967ebfc962861532edbe /src/lib/upnp/Discovery.cxx | |
parent | 3d446d3266e11fd6618a8caca3c31ef0cfededc0 (diff) | |
download | mpd-833ec3d3cdb206dc41420e067874e355569bd225.tar.gz mpd-833ec3d3cdb206dc41420e067874e355569bd225.tar.xz mpd-833ec3d3cdb206dc41420e067874e355569bd225.zip |
lib/upnp/Discovery: remove locking from ExpireDevices()
Diffstat (limited to 'src/lib/upnp/Discovery.cxx')
-rw-r--r-- | src/lib/upnp/Discovery.cxx | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx index 80157c707..f6a3ba122 100644 --- a/src/lib/upnp/Discovery.cxx +++ b/src/lib/upnp/Discovery.cxx @@ -212,7 +212,6 @@ UPnPDeviceDirectory::Invoke(Upnp_EventType et, void *evp) bool UPnPDeviceDirectory::ExpireDevices(Error &error) { - const ScopeLock protect(mutex); const unsigned now = MonotonicClockS(); bool didsomething = false; @@ -291,12 +290,11 @@ bool UPnPDeviceDirectory::GetDirectories(std::vector<ContentDirectoryService> &out, Error &error) { - // Has locking, do it before our own lock + const ScopeLock protect(mutex); + if (!ExpireDevices(error)) return false; - const ScopeLock protect(mutex); - for (auto dit = directories.begin(); dit != directories.end(); dit++) { for (const auto &service : dit->device.services) { @@ -314,12 +312,11 @@ UPnPDeviceDirectory::GetServer(const char *friendly_name, ContentDirectoryService &server, Error &error) { - // Has locking, do it before our own lock + const ScopeLock protect(mutex); + if (!ExpireDevices(error)) return false; - const ScopeLock protect(mutex); - for (const auto &i : directories) { const auto &device = i.device; |