Move current daemon destruction logic to RealSystemState.
The UpdateAttempter requires to release the dbus_adaptor pointer
before detruction to avoid sending messages over a dead DBus connection.
This patch moves this logic out of the UpdateEngineDaemon class.
Bug: None
TEST=mm; Tested on Brillo.
Change-Id: I8939c5a2940f435e2e8f574910e0fa2674dc725f
diff --git a/real_system_state.cc b/real_system_state.cc
index 349167b..906ec97 100644
--- a/real_system_state.cc
+++ b/real_system_state.cc
@@ -40,6 +40,13 @@
libcros_proxy_(bus) {
}
+RealSystemState::~RealSystemState() {
+ // Prevent any DBus communication from UpdateAttempter when shutting down the
+ // daemon.
+ if (update_attempter_)
+ update_attempter_->set_dbus_adaptor(nullptr);
+}
+
bool RealSystemState::Initialize() {
metrics_lib_.Init();