Commit 8aef518c authored by Max Kellermann's avatar Max Kellermann

lib/upnp/Discovery: add method GetEventLoop()

parent 309ed77e
......@@ -45,7 +45,7 @@ UPnPDeviceDirectory::Downloader::Downloader(UPnPDeviceDirectory &_parent,
void
UPnPDeviceDirectory::Downloader::Start()
{
auto &event_loop = parent.curl->GetEventLoop();
auto &event_loop = parent.GetEventLoop();
BlockingCall(event_loop, [this](){
request.Start();
......@@ -187,7 +187,7 @@ UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco)
try {
downloader->Start();
} catch (...) {
BlockingCall(curl->GetEventLoop(), [downloader](){
BlockingCall(GetEventLoop(), [downloader](){
downloader->Destroy();
});
......@@ -267,11 +267,17 @@ UPnPDeviceDirectory::UPnPDeviceDirectory(EventLoop &event_loop,
UPnPDeviceDirectory::~UPnPDeviceDirectory()
{
BlockingCall(curl->GetEventLoop(), [this](){
BlockingCall(GetEventLoop(), [this](){
downloaders.clear_and_dispose(DeleteDisposer());
});
}
inline EventLoop &
UPnPDeviceDirectory::GetEventLoop()
{
return curl->GetEventLoop();
}
void
UPnPDeviceDirectory::Start()
{
......
......@@ -143,6 +143,8 @@ public:
UPnPDeviceDirectory(const UPnPDeviceDirectory &) = delete;
UPnPDeviceDirectory& operator=(const UPnPDeviceDirectory &) = delete;
EventLoop &GetEventLoop();
void Start();
/** Retrieve the directory services currently seen on the network */
......
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