Commit 6fa403ed authored by Max Kellermann's avatar Max Kellermann

lib/upnp/Discovery: migrate from DeferredMonitor to DeferEvent

parent 431eb7bc
......@@ -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)
......@@ -50,12 +52,6 @@ UPnPDeviceDirectory::Downloader::Destroy()
}
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,
......
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