Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1027)

Unified Diff: src/platform/update_engine/main.cc

Issue 2037005: AU: check after 2 min, also every 30 min. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: fix misspelling Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/platform/update_engine/update_check_action.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/update_engine/main.cc
diff --git a/src/platform/update_engine/main.cc b/src/platform/update_engine/main.cc
index f61ff3454cb877d84e0f8e225edc2314eb1cd6bc..b2f14c4b50b9d71694b82a34a43c5ef60fba87cd 100644
--- a/src/platform/update_engine/main.cc
+++ b/src/platform/update_engine/main.cc
@@ -26,6 +26,19 @@ using std::vector;
namespace chromeos_update_engine {
+namespace {
+
+struct PeriodicallyUpdateArgs {
+ UpdateAttempter* update_attempter;
+ gboolean should_repeat;
+};
+
+gboolean PeriodicallyUpdate(void* arg) {
+ PeriodicallyUpdateArgs* args = reinterpret_cast<PeriodicallyUpdateArgs*>(arg);
+ args->update_attempter->Update(false);
+ return args->should_repeat;
+}
+
void SetupDbusService(UpdateEngineService* service) {
DBusGConnection *bus;
DBusGProxy *proxy;
@@ -60,6 +73,8 @@ void SetupDbusService(UpdateEngineService* service) {
G_OBJECT(service));
}
+} // namespace {}
+
} // namespace chromeos_update_engine
#include "update_engine/subprocess.h"
@@ -71,7 +86,7 @@ int main(int argc, char** argv) {
chromeos_update_engine::Subprocess::Init();
google::ParseCommandLineFlags(&argc, &argv, true);
CommandLine::Init(argc, argv);
- logging::InitLogging("logfile.txt",
+ logging::InitLogging("/var/log/update_engine.log",
(FLAGS_logtostderr ?
logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG :
logging::LOG_ONLY_TO_FILE),
@@ -94,6 +109,20 @@ int main(int argc, char** argv) {
update_attempter.set_dbus_service(service);
chromeos_update_engine::SetupDbusService(service);
+ // Kick off periodic updating. First, update after 2 minutes. Also, update
+ // every 30 minutes.
+ chromeos_update_engine::PeriodicallyUpdateArgs two_min_args =
+ {&update_attempter, FALSE};
+ g_timeout_add(2 * 60 * 1000,
+ &chromeos_update_engine::PeriodicallyUpdate,
+ &two_min_args);
+
+ chromeos_update_engine::PeriodicallyUpdateArgs thirty_min_args =
+ {&update_attempter, TRUE};
+ g_timeout_add(30 * 60 * 1000,
+ &chromeos_update_engine::PeriodicallyUpdate,
+ &thirty_min_args);
+
// Run the main loop until exit time:
g_main_loop_run(loop);
« no previous file with comments | « no previous file | src/platform/update_engine/update_check_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698