aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/db/plugins/upnp/UpnpDatabasePlugin.cxx8
-rw-r--r--src/lib/upnp/ContentDirectoryService.hxx3
-rw-r--r--src/lib/upnp/Discovery.cxx46
-rw-r--r--src/lib/upnp/Discovery.hxx25
-rw-r--r--src/neighbor/plugins/UpnpNeighborPlugin.cxx2
5 files changed, 42 insertions, 42 deletions
diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
index 9f0841780..9d2d00eb6 100644
--- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
+++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx
@@ -222,7 +222,7 @@ UpnpDatabase::GetSong(const char *uri, Error &error) const
}
ContentDirectoryService server;
- if (!discovery->getServer(vpath.front().c_str(), server, error))
+ if (!discovery->GetServer(vpath.front().c_str(), server, error))
return nullptr;
vpath.pop_front();
@@ -689,7 +689,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
auto vpath = stringToTokens(selection.uri, "/", true);
if (vpath.empty()) {
std::vector<ContentDirectoryService> servers;
- if (!discovery->getDirServices(servers, error))
+ if (!discovery->GetDirectories(servers, error))
return false;
for (const auto &server : servers) {
@@ -714,7 +714,7 @@ UpnpDatabase::Visit(const DatabaseSelection &selection,
vpath.pop_front();
ContentDirectoryService server;
- if (!discovery->getServer(servername.c_str(), server, error))
+ if (!discovery->GetServer(servername.c_str(), server, error))
return false;
return VisitServer(server, vpath, selection,
@@ -733,7 +733,7 @@ UpnpDatabase::VisitUniqueTags(const DatabaseSelection &selection,
return true;
std::vector<ContentDirectoryService> servers;
- if (!discovery->getDirServices(servers, error))
+ if (!discovery->GetDirectories(servers, error))
return false;
std::set<std::string> values;
diff --git a/src/lib/upnp/ContentDirectoryService.hxx b/src/lib/upnp/ContentDirectoryService.hxx
index 576c6ec8c..bf6ab913a 100644
--- a/src/lib/upnp/ContentDirectoryService.hxx
+++ b/src/lib/upnp/ContentDirectoryService.hxx
@@ -62,7 +62,8 @@ public:
/**
* Construct by copying data from device and service objects.
*
- * The discovery service does this: use getDirServices()
+ * The discovery service does this: use
+ * UPnPDeviceDirectory::GetDirectories()
*/
ContentDirectoryService(const UPnPDevice &device,
const UPnPService &service);
diff --git a/src/lib/upnp/Discovery.cxx b/src/lib/upnp/Discovery.cxx
index 8759278ce..80157c707 100644
--- a/src/lib/upnp/Discovery.cxx
+++ b/src/lib/upnp/Discovery.cxx
@@ -107,12 +107,12 @@ UPnPDeviceDirectory::LockRemove(const std::string &id)
}
inline void
-UPnPDeviceDirectory::discoExplorer()
+UPnPDeviceDirectory::Explore()
{
for (;;) {
DiscoveredTask *tsk = 0;
- if (!discoveredQueue.take(tsk)) {
- discoveredQueue.workerExit();
+ if (!queue.take(tsk)) {
+ queue.workerExit();
return;
}
@@ -128,7 +128,7 @@ UPnPDeviceDirectory::discoExplorer()
}
// Update or insert the device
- ContentDirectoryDescriptor d(std::move(tsk->deviceId),
+ ContentDirectoryDescriptor d(std::move(tsk->device_id),
MonotonicClockS(), tsk->expires);
{
@@ -148,10 +148,10 @@ UPnPDeviceDirectory::discoExplorer()
}
void *
-UPnPDeviceDirectory::discoExplorer(void *ctx)
+UPnPDeviceDirectory::Explore(void *ctx)
{
UPnPDeviceDirectory &directory = *(UPnPDeviceDirectory *)ctx;
- directory.discoExplorer();
+ directory.Explore();
return (void*)1;
}
@@ -161,7 +161,7 @@ UPnPDeviceDirectory::OnAlive(Upnp_Discovery *disco)
if (isMSDevice(disco->DeviceType) ||
isCDService(disco->ServiceType)) {
DiscoveredTask *tp = new DiscoveredTask(disco);
- if (discoveredQueue.put(tp))
+ if (queue.put(tp))
return UPNP_E_FINISH;
}
@@ -210,7 +210,7 @@ UPnPDeviceDirectory::Invoke(Upnp_EventType et, void *evp)
}
bool
-UPnPDeviceDirectory::expireDevices(Error &error)
+UPnPDeviceDirectory::ExpireDevices(Error &error)
{
const ScopeLock protect(mutex);
const unsigned now = MonotonicClockS();
@@ -227,7 +227,7 @@ UPnPDeviceDirectory::expireDevices(Error &error)
}
if (didsomething)
- return search(error);
+ return Search(error);
return true;
}
@@ -236,8 +236,8 @@ UPnPDeviceDirectory::UPnPDeviceDirectory(UpnpClient_Handle _handle,
UPnPDiscoveryListener *_listener)
:handle(_handle),
listener(_listener),
- discoveredQueue("DiscoveredQueue"),
- m_searchTimeout(2), m_lastSearch(0)
+ queue("DiscoveredQueue"),
+ search_timeout(2), last_search(0)
{
}
@@ -249,24 +249,24 @@ UPnPDeviceDirectory::~UPnPDeviceDirectory()
bool
UPnPDeviceDirectory::Start(Error &error)
{
- if (!discoveredQueue.start(1, discoExplorer, this)) {
+ if (!queue.start(1, Explore, this)) {
error.Set(upnp_domain, "Discover work queue start failed");
return false;
}
- return search(error);
+ return Search(error);
}
bool
-UPnPDeviceDirectory::search(Error &error)
+UPnPDeviceDirectory::Search(Error &error)
{
const unsigned now = MonotonicClockS();
- if (now - m_lastSearch < 10)
+ if (now - last_search < 10)
return true;
- m_lastSearch = now;
+ last_search = now;
// We search both for device and service just in case.
- int code = UpnpSearchAsync(handle, m_searchTimeout,
+ int code = UpnpSearchAsync(handle, search_timeout,
ContentDirectorySType, GetUpnpCookie());
if (code != UPNP_E_SUCCESS) {
error.Format(upnp_domain, code,
@@ -275,7 +275,7 @@ UPnPDeviceDirectory::search(Error &error)
return false;
}
- code = UpnpSearchAsync(handle, m_searchTimeout,
+ code = UpnpSearchAsync(handle, search_timeout,
MediaServerDType, GetUpnpCookie());
if (code != UPNP_E_SUCCESS) {
error.Format(upnp_domain, code,
@@ -288,11 +288,11 @@ UPnPDeviceDirectory::search(Error &error)
}
bool
-UPnPDeviceDirectory::getDirServices(std::vector<ContentDirectoryService> &out,
+UPnPDeviceDirectory::GetDirectories(std::vector<ContentDirectoryService> &out,
Error &error)
{
// Has locking, do it before our own lock
- if (!expireDevices(error))
+ if (!ExpireDevices(error))
return false;
const ScopeLock protect(mutex);
@@ -310,12 +310,12 @@ UPnPDeviceDirectory::getDirServices(std::vector<ContentDirectoryService> &out,
}
bool
-UPnPDeviceDirectory::getServer(const char *friendlyName,
+UPnPDeviceDirectory::GetServer(const char *friendly_name,
ContentDirectoryService &server,
Error &error)
{
// Has locking, do it before our own lock
- if (!expireDevices(error))
+ if (!ExpireDevices(error))
return false;
const ScopeLock protect(mutex);
@@ -323,7 +323,7 @@ UPnPDeviceDirectory::getServer(const char *friendlyName,
for (const auto &i : directories) {
const auto &device = i.device;
- if (device.friendlyName != friendlyName)
+ if (device.friendlyName != friendly_name)
continue;
for (const auto &service : device.services) {
diff --git a/src/lib/upnp/Discovery.hxx b/src/lib/upnp/Discovery.hxx
index 4f947f67a..970fb306e 100644
--- a/src/lib/upnp/Discovery.hxx
+++ b/src/lib/upnp/Discovery.hxx
@@ -55,13 +55,13 @@ class UPnPDeviceDirectory final : UpnpCallback {
*/
struct DiscoveredTask {
std::string url;
- std::string deviceId;
+ std::string device_id;
unsigned expires; // Seconds valid
DiscoveredTask(const Upnp_Discovery *disco)
:url(disco->Location),
- deviceId(disco->DeviceId),
- expires(disco->Expires) {}
+ device_id(disco->DeviceId),
+ expires(disco->Expires) {}
};
/**
@@ -97,19 +97,19 @@ class UPnPDeviceDirectory final : UpnpCallback {
Mutex mutex;
std::list<ContentDirectoryDescriptor> directories;
- WorkQueue<DiscoveredTask *> discoveredQueue;
+ WorkQueue<DiscoveredTask *> queue;
/**
* The UPnP device search timeout, which should actually be
* called delay because it's the base of a random delay that
* the devices apply to avoid responding all at the same time.
*/
- int m_searchTimeout;
+ int search_timeout;
/**
* The MonotonicClockS() time stamp of the last search.
*/
- unsigned m_lastSearch;
+ unsigned last_search;
public:
UPnPDeviceDirectory(UpnpClient_Handle _handle,
@@ -122,24 +122,24 @@ public:
bool Start(Error &error);
/** Retrieve the directory services currently seen on the network */
- bool getDirServices(std::vector<ContentDirectoryService> &, Error &);
+ bool GetDirectories(std::vector<ContentDirectoryService> &, Error &);
/**
* Get server by friendly name.
*/
- bool getServer(const char *friendlyName,
+ bool GetServer(const char *friendly_name,
ContentDirectoryService &server,
Error &error);
private:
- bool search(Error &error);
+ bool Search(Error &error);
/**
* Look at the devices and get rid of those which have not
* been seen for too long. We do this when listing the top
* directory.
*/
- bool expireDevices(Error &error);
+ bool ExpireDevices(Error &error);
void LockAdd(ContentDirectoryDescriptor &&d);
void LockRemove(const std::string &id);
@@ -149,12 +149,11 @@ private:
* devices appearing and disappearing, and update the
* directory pool accordingly.
*/
- static void *discoExplorer(void *);
- void discoExplorer();
+ static void *Explore(void *);
+ void Explore();
int OnAlive(Upnp_Discovery *disco);
int OnByeBye(Upnp_Discovery *disco);
- int cluCallBack(Upnp_EventType et, void *evp);
/* virtual methods from class UpnpCallback */
virtual int Invoke(Upnp_EventType et, void *evp) override;
diff --git a/src/neighbor/plugins/UpnpNeighborPlugin.cxx b/src/neighbor/plugins/UpnpNeighborPlugin.cxx
index 28775df4c..3c0cb8843 100644
--- a/src/neighbor/plugins/UpnpNeighborPlugin.cxx
+++ b/src/neighbor/plugins/UpnpNeighborPlugin.cxx
@@ -100,7 +100,7 @@ UpnpNeighborExplorer::GetList() const
{
Error error;
- if (!discovery->getDirServices(tmp, error))
+ if (!discovery->GetDirectories(tmp, error))
LogError(error);
}