summaryrefslogtreecommitdiffstats
path: root/control
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2018-11-09 10:05:34 -0600
committerMatthew Barth <msbarth@us.ibm.com>2018-11-09 10:19:42 -0600
commite8b340bd94021cb8c9eb0725168bfd9fa9e1a670 (patch)
treee6ffd31220f97a078254b084700cee1af8f20688 /control
parent52fbe0d934f8d33ac5fed906df2101c826f566af (diff)
downloadphosphor-fan-presence-e8b340bd94021cb8c9eb0725168bfd9fa9e1a670.tar.gz
phosphor-fan-presence-e8b340bd94021cb8c9eb0725168bfd9fa9e1a670.zip
control: Add interface when not in service cache
When a service is cached, each interface it hosts is added to a list. In the case where an object path given to fan control is never found, a service lookup is performed on this path causing its given interface to be added. This fixes that interface from continuously being added in the case that the object path is attempted to be accessed continuously from dbus. Resolves openbmc/phosphor-fan-presence#12 Tested: Added & removed events containing object paths that dont exist, interface list remains the same size. Change-Id: Id034e7829566979c196cb9901cbea287ddab78d4 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control')
-rw-r--r--control/zone.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/control/zone.cpp b/control/zone.cpp
index 4e8a749..4531151 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -555,8 +555,13 @@ const std::string& Zone::addServices(const std::string& path,
// Service found in cache
for (auto& iIter : sIter.second)
{
- // Add interface to cache
- servIter->second.emplace_back(iIter);
+ if (std::find(servIter->second.begin(),
+ servIter->second.end(),
+ iIter) == servIter->second.end())
+ {
+ // Add interface to cache
+ servIter->second.emplace_back(iIter);
+ }
}
}
else
OpenPOWER on IntegriCloud