diff options
author | Max Kellermann <max@musicpd.org> | 2017-01-26 09:34:53 +0100 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2017-08-25 09:52:44 +0200 |
commit | c8f7a859eafbb4e60f5c247e7fef3f3f1ab806cf (patch) | |
tree | 3571817566a84228b169af23ccabff176b4becfc /src/neighbor | |
parent | 28a2d41b85fce58d02d1205620f8f4ad1d38a2b4 (diff) |
lib/upnp/Discovery: use CURL instead of UpnpDownloadUrlItem()
We can do CURL requests asynchronously, and we don't need a
synchronous WorkQueue thread for that.
This allows parallelizing lookups and allows immediate cancellation.
Diffstat (limited to 'src/neighbor')
-rw-r--r-- | src/neighbor/plugins/UpnpNeighborPlugin.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/neighbor/plugins/UpnpNeighborPlugin.cxx b/src/neighbor/plugins/UpnpNeighborPlugin.cxx index 34e14514f..559d87221 100644 --- a/src/neighbor/plugins/UpnpNeighborPlugin.cxx +++ b/src/neighbor/plugins/UpnpNeighborPlugin.cxx @@ -53,11 +53,14 @@ class UpnpNeighborExplorer final } }; + EventLoop &event_loop; + UPnPDeviceDirectory *discovery; public: - UpnpNeighborExplorer(NeighborListener &_listener) - :NeighborExplorer(_listener) {} + UpnpNeighborExplorer(EventLoop &_event_loop, + NeighborListener &_listener) + :NeighborExplorer(_listener), event_loop(_event_loop) {} /* virtual methods from class NeighborExplorer */ void Open() override; @@ -76,7 +79,7 @@ UpnpNeighborExplorer::Open() UpnpClient_Handle handle; UpnpClientGlobalInit(handle); - discovery = new UPnPDeviceDirectory(handle, this); + discovery = new UPnPDeviceDirectory(event_loop, handle, this); try { discovery->Start(); @@ -126,11 +129,11 @@ UpnpNeighborExplorer::LostUPnP(const ContentDirectoryService &service) } static NeighborExplorer * -upnp_neighbor_create(gcc_unused EventLoop &loop, +upnp_neighbor_create(EventLoop &event_loop, NeighborListener &listener, gcc_unused const ConfigBlock &block) { - return new UpnpNeighborExplorer(listener); + return new UpnpNeighborExplorer(event_loop, listener); } const NeighborPlugin upnp_neighbor_plugin = { |