AU: Announce the update engine status on startup.
This is to ensure that the system is in a consistent state in case update-engine
crashes.
BUG=chromium-os:15069
TEST=press "Check for update" in Chrome, restart update-engine while downloading
an update, see the status go back to 'up to date' (rather than get stuck in
'Downloading')
Change-Id: I1e89502a9fa134ec3a81e50a9036ce20b46eb9b0
Reviewed-on: http://gerrit.chromium.org/gerrit/1144
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
diff --git a/main.cc b/main.cc
index 7d6babf..52e9c9e 100644
--- a/main.cc
+++ b/main.cc
@@ -40,8 +40,12 @@
namespace chromeos_update_engine {
gboolean UpdateBootFlags(void* arg) {
- UpdateAttempter* attempter = reinterpret_cast<UpdateAttempter*>(arg);
- attempter->UpdateBootFlags();
+ reinterpret_cast<UpdateAttempter*>(arg)->UpdateBootFlags();
+ return FALSE; // Don't call this callback again
+}
+
+gboolean BroadcastStatus(void* arg) {
+ reinterpret_cast<UpdateAttempter*>(arg)->BroadcastStatus();
return FALSE; // Don't call this callback again
}
@@ -192,6 +196,10 @@
&chromeos_update_engine::UpdateBootFlags,
&update_attempter);
+ // Broadcast the update engine status on startup to ensure consistent system
+ // state on crashes.
+ g_idle_add(&chromeos_update_engine::BroadcastStatus, &update_attempter);
+
// Run the main loop until exit time:
g_main_loop_run(loop);