diff options
author | Max Kellermann <max@duempel.org> | 2014-01-26 15:04:56 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-01-26 15:04:56 +0100 |
commit | bcc1f933702770c276e7353d71cb0c5fff75bc4a (patch) | |
tree | a7251a557d441353fcc630a8eba67b1e1c695efe /src/lib/upnp/Discovery.cxx | |
parent | b161d723269d851a2d237880b8f5149b58b736c2 (diff) | |
download | mpd-bcc1f933702770c276e7353d71cb0c5fff75bc4a.tar.gz mpd-bcc1f933702770c276e7353d71cb0c5fff75bc4a.tar.xz mpd-bcc1f933702770c276e7353d71cb0c5fff75bc4a.zip |
upnp: add class UpnpCallback
Each Upnp*Async() call passes a new cookie pointer, and the cookie
passed to UpnpRegisterClient() appears to be ignored. Using this
interface is a more elegant approach than having one single "handler"
function.
Diffstat (limited to 'src/lib/upnp/Discovery.cxx')
-rw-r--r-- | src/lib/upnp/Discovery.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx index da32372ba..ce512bdde 100644 --- a/src/lib/upnp/Discovery.cxx +++ b/src/lib/upnp/Discovery.cxx @@ -184,8 +184,8 @@ UPnPDeviceDirectory::OnByeBye(Upnp_Discovery *disco) // thread context. // Example: ContentDirectories appearing and disappearing from the network // We queue a task for our worker thread(s) -inline int -UPnPDeviceDirectory::cluCallBack(Upnp_EventType et, void *evp) +int +UPnPDeviceDirectory::Invoke(Upnp_EventType et, void *evp) { switch (et) { case UPNP_DISCOVERY_SEARCH_RESULT: @@ -254,10 +254,6 @@ UPnPDeviceDirectory::Start(Error &error) return false; } - lib->SetHandler([this](Upnp_EventType type, void *event){ - cluCallBack(type, event); - }); - return search(error); } @@ -271,7 +267,7 @@ UPnPDeviceDirectory::search(Error &error) // We search both for device and service just in case. int code = UpnpSearchAsync(lib->getclh(), m_searchTimeout, - ContentDirectorySType, lib); + ContentDirectorySType, GetUpnpCookie()); if (code != UPNP_E_SUCCESS) { error.Format(upnp_domain, code, "UpnpSearchAsync() failed: %s", @@ -280,7 +276,7 @@ UPnPDeviceDirectory::search(Error &error) } code = UpnpSearchAsync(lib->getclh(), m_searchTimeout, - MediaServerDType, lib); + MediaServerDType, GetUpnpCookie()); if (code != UPNP_E_SUCCESS) { error.Format(upnp_domain, code, "UpnpSearchAsync() failed: %s", |