Handle losing association endpoints

If the endpoint path of an association (not the path that has the
org.openbmc.Associations interface) goes off of D-Bus, then remove the 2
association objects and move this association to the list of pending
ones.  That way if it ever comes back, the association objects will be
re-added.

This commit adds a moveAssociationToPending function in the code paths
where the mapper sees D-Bus paths going away.  That function will find
all associations that involve that path, and then remove the actual
association paths and add them to the list of pending ones.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I14d5ddf8f65be866c2cedd5f467d65adf8e3af95
diff --git a/src/associations.hpp b/src/associations.hpp
index 37f5e54..dd6cbdb 100644
--- a/src/associations.hpp
+++ b/src/associations.hpp
@@ -164,3 +164,18 @@
 void findAssociations(const std::string& endpointPath,
                       AssociationMaps& assocMaps,
                       FindAssocResults& associationData);
+
+/** @brief If endpointPath is in an association, move that association
+ *         to pending and remove the association objects.
+ *
+ *  Called when a path is going off of D-Bus.  If this path is an
+ *  association endpoint (the path that owns the association is still
+ *  on D-Bus), then move the association it's involved in to pending.
+ *
+ * @param[in] endpointPath  - the D-Bus endpoint path to check
+ * @param[in,out] assocMaps - The association maps
+ * @param[in,out] server    - sdbus system object
+ */
+void moveAssociationToPending(const std::string& endpointPath,
+                              AssociationMaps& assocMaps,
+                              sdbusplus::asio::object_server& server);