Use a single dbus connection object
Starting with sdbusplus 8ca6025, calling bus_new_default multiple times
doesn't seem to work - making calls that generate dbus traffic on one
of the objects results in something like:
sd_bus_call: System.Error.ENOTCONN: Transport endpoint is not connected
This wasn't ideal anyway - move to a single object, shared
application-wide.
Tested: Booted a witherspoon QEMU image and there were no coredumps
Change-Id: I804a1b1438b22f48e45b26d395135e401ca98a06
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/settings.hpp b/settings.hpp
index 8a89e74..b4893cb 100644
--- a/settings.hpp
+++ b/settings.hpp
@@ -25,9 +25,10 @@
*
* @param[in] bus - The D-bus bus object
*/
- Objects();
- Objects(const Objects&) = default;
- Objects& operator=(const Objects&) = default;
+ Objects() = delete;
+ explicit Objects(sdbusplus::bus::bus&);
+ Objects(const Objects&) = delete;
+ Objects& operator=(const Objects&) = delete;
Objects(Objects&&) = default;
Objects& operator=(Objects&&) = default;
~Objects() = default;
@@ -51,6 +52,9 @@
/** @brief host state object */
Path hostState;
+
+ private:
+ sdbusplus::bus::bus& bus;
};
} // namespace settings