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