path: root/control
diff options
authorMatthew Barth <>2018-11-09 10:05:34 -0600
committerMatthew Barth <>2018-11-09 10:19:42 -0600
commite8b340bd94021cb8c9eb0725168bfd9fa9e1a670 (patch)
treee6ffd31220f97a078254b084700cee1af8f20688 /control
parent52fbe0d934f8d33ac5fed906df2101c826f566af (diff)
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 <>
Diffstat (limited to 'control')
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);
+ }
OpenPOWER on IntegriCloud