upnp/Discovery: use std::unique_ptr in WorkQueue
This commit is contained in:
parent
050c6cc4b0
commit
224d511616
@ -111,7 +111,7 @@ inline void
|
||||
UPnPDeviceDirectory::Explore()
|
||||
{
|
||||
for (;;) {
|
||||
DiscoveredTask *tsk = 0;
|
||||
std::unique_ptr<DiscoveredTask> tsk;
|
||||
if (!queue.take(tsk)) {
|
||||
queue.workerExit();
|
||||
return;
|
||||
@ -138,14 +138,12 @@ UPnPDeviceDirectory::Explore()
|
||||
Error error2;
|
||||
bool success = d.Parse(tsk->url, buf, error2);
|
||||
if (!success) {
|
||||
delete tsk;
|
||||
LogError(error2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
LockAdd(std::move(d));
|
||||
delete tsk;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
class ContentDirectoryService;
|
||||
|
||||
@ -97,7 +98,7 @@ class UPnPDeviceDirectory final : UpnpCallback {
|
||||
|
||||
Mutex mutex;
|
||||
std::list<ContentDirectoryDescriptor> directories;
|
||||
WorkQueue<DiscoveredTask *> queue;
|
||||
WorkQueue<std::unique_ptr<DiscoveredTask>> queue;
|
||||
|
||||
/**
|
||||
* The UPnP device search timeout, which should actually be
|
||||
|
Loading…
Reference in New Issue
Block a user