Commit fab6cbed authored by Max Kellermann's avatar Max Kellermann

db/upnp/Discovery: eliminate attribute "last_seen"

parent 051eede1
...@@ -170,7 +170,7 @@ UPnPDeviceDirectory::expireDevices(Error &error) ...@@ -170,7 +170,7 @@ UPnPDeviceDirectory::expireDevices(Error &error)
for (auto it = directories.begin(); for (auto it = directories.begin();
it != directories.end();) { it != directories.end();) {
if (now - it->second.last_seen > it->second.expires) { if (now > it->second.expires) {
it = directories.erase(it); it = directories.erase(it);
didsomething = true; didsomething = true;
} else { } else {
......
...@@ -67,16 +67,14 @@ class UPnPDeviceDirectory { ...@@ -67,16 +67,14 @@ class UPnPDeviceDirectory {
/** /**
* The MonotonicClockS() time stamp when this device * The MonotonicClockS() time stamp when this device
* was last seen alive. * expires.
*/ */
unsigned last_seen; unsigned expires;
unsigned expires; // seconds valid
ContentDirectoryDescriptor() = default; ContentDirectoryDescriptor() = default;
ContentDirectoryDescriptor(unsigned last, int exp) ContentDirectoryDescriptor(unsigned last, int exp)
:last_seen(last), expires(exp+20) {} :expires(last + exp + 20) {}
bool Parse(const std::string &url, const char *description, bool Parse(const std::string &url, const char *description,
Error &_error) { Error &_error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment