lib/upnp/Discovery: migrate from DeferredMonitor to DeferEvent
This commit is contained in:
parent
431eb7bc8c
commit
6fa403edd9
@ -34,7 +34,9 @@
|
||||
|
||||
UPnPDeviceDirectory::Downloader::Downloader(UPnPDeviceDirectory &_parent,
|
||||
const Upnp_Discovery &disco)
|
||||
:DeferredMonitor(_parent.GetEventLoop()), parent(_parent),
|
||||
:defer_start_event(_parent.GetEventLoop(),
|
||||
BIND_THIS_METHOD(OnDeferredStart)),
|
||||
parent(_parent),
|
||||
id(disco.DeviceId), url(disco.Location),
|
||||
expires(std::chrono::seconds(disco.Expires)),
|
||||
request(*parent.curl, url.c_str(), *this)
|
||||
@ -49,12 +51,6 @@ UPnPDeviceDirectory::Downloader::Destroy()
|
||||
DeleteDisposer());
|
||||
}
|
||||
|
||||
void
|
||||
UPnPDeviceDirectory::Downloader::RunDeferred()
|
||||
{
|
||||
request.Start();
|
||||
}
|
||||
|
||||
void
|
||||
UPnPDeviceDirectory::Downloader::OnHeaders(unsigned status,
|
||||
std::multimap<std::string, std::string> &&)
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "lib/curl/Handler.hxx"
|
||||
#include "lib/curl/Request.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "event/DeferredMonitor.hxx"
|
||||
#include "event/DeferEvent.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <upnp/upnp.h>
|
||||
@ -84,7 +84,9 @@ class UPnPDeviceDirectory final : UpnpCallback {
|
||||
|
||||
class Downloader final
|
||||
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>>,
|
||||
DeferredMonitor, CurlResponseHandler {
|
||||
CurlResponseHandler {
|
||||
|
||||
DeferEvent defer_start_event;
|
||||
|
||||
UPnPDeviceDirectory &parent;
|
||||
|
||||
@ -101,14 +103,15 @@ class UPnPDeviceDirectory final : UpnpCallback {
|
||||
const Upnp_Discovery &disco);
|
||||
|
||||
void Start() {
|
||||
DeferredMonitor::Schedule();
|
||||
defer_start_event.Schedule();
|
||||
}
|
||||
|
||||
void Destroy();
|
||||
|
||||
private:
|
||||
/* virtual methods from DeferredMonitor */
|
||||
void RunDeferred() override;
|
||||
void OnDeferredStart() {
|
||||
request.Start();
|
||||
}
|
||||
|
||||
/* virtual methods from CurlResponseHandler */
|
||||
void OnHeaders(unsigned status,
|
||||
|
Loading…
Reference in New Issue
Block a user