db/upnp: don't use WorkQueue for _ADVERTISEMENT_BYEBYE
Remove the ContentDirectoryDescriptor right away. Reduces bloat.
This commit is contained in:
parent
b635610409
commit
b9f02f22c4
@ -62,13 +62,6 @@ UPnPDeviceDirectory::discoExplorer()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ScopeLock protect(mutex);
|
const ScopeLock protect(mutex);
|
||||||
if (!tsk->alive) {
|
|
||||||
// Device signals it is going off.
|
|
||||||
auto it = directories.find(tsk->deviceId);
|
|
||||||
if (it != directories.end()) {
|
|
||||||
directories.erase(it);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Device signals its existence and well-being. Perform the
|
// Device signals its existence and well-being. Perform the
|
||||||
// UPnP "description" phase by downloading and decoding the
|
// UPnP "description" phase by downloading and decoding the
|
||||||
// description document.
|
// description document.
|
||||||
@ -95,7 +88,7 @@ UPnPDeviceDirectory::discoExplorer()
|
|||||||
#endif
|
#endif
|
||||||
if (!e.second)
|
if (!e.second)
|
||||||
e.first->second = d;
|
e.first->second = d;
|
||||||
}
|
|
||||||
delete tsk;
|
delete tsk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +106,7 @@ UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco)
|
|||||||
{
|
{
|
||||||
if (isMSDevice(disco->DeviceType) ||
|
if (isMSDevice(disco->DeviceType) ||
|
||||||
isCDService(disco->ServiceType)) {
|
isCDService(disco->ServiceType)) {
|
||||||
DiscoveredTask *tp = new DiscoveredTask(1, disco);
|
DiscoveredTask *tp = new DiscoveredTask(disco);
|
||||||
if (discoveredQueue.put(tp))
|
if (discoveredQueue.put(tp))
|
||||||
return UPNP_E_FINISH;
|
return UPNP_E_FINISH;
|
||||||
}
|
}
|
||||||
@ -127,9 +120,11 @@ UPnPDeviceDirectory::OnByeBye(Upnp_Discovery *disco)
|
|||||||
|
|
||||||
if (isMSDevice(disco->DeviceType) ||
|
if (isMSDevice(disco->DeviceType) ||
|
||||||
isCDService(disco->ServiceType)) {
|
isCDService(disco->ServiceType)) {
|
||||||
DiscoveredTask *tp = new DiscoveredTask(0, disco);
|
// Device signals it is going off.
|
||||||
if (discoveredQueue.put(tp))
|
const ScopeLock protect(mutex);
|
||||||
return UPNP_E_FINISH;
|
auto it = directories.find(disco->DeviceId);
|
||||||
|
if (it != directories.end())
|
||||||
|
directories.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
return UPNP_E_SUCCESS;
|
return UPNP_E_SUCCESS;
|
||||||
|
@ -49,13 +49,12 @@ class UPnPDeviceDirectory {
|
|||||||
* discovery thread.
|
* discovery thread.
|
||||||
*/
|
*/
|
||||||
struct DiscoveredTask {
|
struct DiscoveredTask {
|
||||||
bool alive;
|
|
||||||
std::string url;
|
std::string url;
|
||||||
std::string deviceId;
|
std::string deviceId;
|
||||||
int expires; // Seconds valid
|
int expires; // Seconds valid
|
||||||
|
|
||||||
DiscoveredTask(bool _alive, const Upnp_Discovery *disco)
|
DiscoveredTask(const Upnp_Discovery *disco)
|
||||||
: alive(_alive), url(disco->Location),
|
:url(disco->Location),
|
||||||
deviceId(disco->DeviceId),
|
deviceId(disco->DeviceId),
|
||||||
expires(disco->Expires) {}
|
expires(disco->Expires) {}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user