aboutsummaryrefslogtreecommitdiffstats
path: root/src/db/upnp/Discovery.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-01-13 22:05:45 +0100
committerMax Kellermann <max@duempel.org>2014-01-13 22:24:02 +0100
commitca43e634b5adfebdcb9c3c8f61cebf38d42827e0 (patch)
treefab541d75386417187052650dcee16eb5c48f3b4 /src/db/upnp/Discovery.cxx
parent85324f80fe1d72a066cc49847815830080eb1bc3 (diff)
downloadmpd-ca43e634b5adfebdcb9c3c8f61cebf38d42827e0.tar.gz
mpd-ca43e634b5adfebdcb9c3c8f61cebf38d42827e0.tar.xz
mpd-ca43e634b5adfebdcb9c3c8f61cebf38d42827e0.zip
db/upnp: use std::function for the libupnp callback
Replaces the bloated std::map.
Diffstat (limited to '')
-rw-r--r--src/db/upnp/Discovery.cxx10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/db/upnp/Discovery.cxx b/src/db/upnp/Discovery.cxx
index a94f29d8c..8a2b7046d 100644
--- a/src/db/upnp/Discovery.cxx
+++ b/src/db/upnp/Discovery.cxx
@@ -158,7 +158,7 @@ discoExplorer(void *)
// mutex just for clarifying the message printing, the workqueue is
// mt-safe of course.
static int
-cluCallBack(Upnp_EventType et, void *evp, void *)
+cluCallBack(Upnp_EventType et, void *evp)
{
static Mutex cblock;
const ScopeLock protect(cblock);
@@ -231,11 +231,9 @@ UPnPDeviceDirectory::UPnPDeviceDirectory()
if (lib == nullptr)
return;
- lib->registerHandler(UPNP_DISCOVERY_SEARCH_RESULT, cluCallBack, this);
- lib->registerHandler(UPNP_DISCOVERY_ADVERTISEMENT_ALIVE,
- cluCallBack, this);
- lib->registerHandler(UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE,
- cluCallBack, this);
+ lib->SetHandler([](Upnp_EventType type, void *event){
+ cluCallBack(type, event);
+ });
search();
}