lib/upnp/Discovery: add method GetEventLoop()
This commit is contained in:
@@ -45,7 +45,7 @@ UPnPDeviceDirectory::Downloader::Downloader(UPnPDeviceDirectory &_parent,
|
|||||||
void
|
void
|
||||||
UPnPDeviceDirectory::Downloader::Start()
|
UPnPDeviceDirectory::Downloader::Start()
|
||||||
{
|
{
|
||||||
auto &event_loop = parent.curl->GetEventLoop();
|
auto &event_loop = parent.GetEventLoop();
|
||||||
|
|
||||||
BlockingCall(event_loop, [this](){
|
BlockingCall(event_loop, [this](){
|
||||||
request.Start();
|
request.Start();
|
||||||
@@ -187,7 +187,7 @@ UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco)
|
|||||||
try {
|
try {
|
||||||
downloader->Start();
|
downloader->Start();
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
BlockingCall(curl->GetEventLoop(), [downloader](){
|
BlockingCall(GetEventLoop(), [downloader](){
|
||||||
downloader->Destroy();
|
downloader->Destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -267,11 +267,17 @@ UPnPDeviceDirectory::UPnPDeviceDirectory(EventLoop &event_loop,
|
|||||||
|
|
||||||
UPnPDeviceDirectory::~UPnPDeviceDirectory()
|
UPnPDeviceDirectory::~UPnPDeviceDirectory()
|
||||||
{
|
{
|
||||||
BlockingCall(curl->GetEventLoop(), [this](){
|
BlockingCall(GetEventLoop(), [this](){
|
||||||
downloaders.clear_and_dispose(DeleteDisposer());
|
downloaders.clear_and_dispose(DeleteDisposer());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline EventLoop &
|
||||||
|
UPnPDeviceDirectory::GetEventLoop()
|
||||||
|
{
|
||||||
|
return curl->GetEventLoop();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
UPnPDeviceDirectory::Start()
|
UPnPDeviceDirectory::Start()
|
||||||
{
|
{
|
||||||
|
@@ -143,6 +143,8 @@ public:
|
|||||||
UPnPDeviceDirectory(const UPnPDeviceDirectory &) = delete;
|
UPnPDeviceDirectory(const UPnPDeviceDirectory &) = delete;
|
||||||
UPnPDeviceDirectory& operator=(const UPnPDeviceDirectory &) = delete;
|
UPnPDeviceDirectory& operator=(const UPnPDeviceDirectory &) = delete;
|
||||||
|
|
||||||
|
EventLoop &GetEventLoop();
|
||||||
|
|
||||||
void Start();
|
void Start();
|
||||||
|
|
||||||
/** Retrieve the directory services currently seen on the network */
|
/** Retrieve the directory services currently seen on the network */
|
||||||
|
Reference in New Issue
Block a user