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

Side by Side Diff: main.cc

Issue 3215006: AU: Implement exponential back off for 500 and 503 HTTP response codes. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: elaborate on the CHECK Created 10 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « download_action.h ('k') | omaha_request_action.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 #include <tr1/memory> 6 #include <tr1/memory>
7 #include <vector> 7 #include <vector>
8 8
9 #include <base/at_exit.h>
10 #include <base/command_line.h>
11 #include <base/logging.h>
12 #include <base/string_util.h>
9 #include <gflags/gflags.h> 13 #include <gflags/gflags.h>
10 #include <glib.h> 14 #include <glib.h>
15 #include <metrics/metrics_library.h>
11 16
12 #include "base/at_exit.h"
13 #include "base/command_line.h"
14 #include "base/logging.h"
15 #include "base/string_util.h"
16 #include "metrics/metrics_library.h"
17 #include "update_engine/dbus_constants.h" 17 #include "update_engine/dbus_constants.h"
18 #include "update_engine/dbus_service.h" 18 #include "update_engine/dbus_service.h"
19 #include "update_engine/prefs.h" 19 #include "update_engine/prefs.h"
20 #include "update_engine/subprocess.h" 20 #include "update_engine/subprocess.h"
21 #include "update_engine/update_attempter.h" 21 #include "update_engine/update_attempter.h"
22 #include "update_engine/utils.h" 22 #include "update_engine/update_check_scheduler.h"
23 23
24 extern "C" { 24 extern "C" {
25 #include "update_engine/update_engine.dbusserver.h" 25 #include "update_engine/update_engine.dbusserver.h"
26 } 26 }
27 27
28 DEFINE_bool(logtostderr, false, 28 DEFINE_bool(logtostderr, false,
29 "Write logs to stderr instead of to a file in log_dir."); 29 "Write logs to stderr instead of to a file in log_dir.");
30 DEFINE_bool(foreground, false, 30 DEFINE_bool(foreground, false,
31 "Don't daemon()ize; run in foreground."); 31 "Don't daemon()ize; run in foreground.");
32 32
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 // Create the dbus service object: 122 // Create the dbus service object:
123 dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE, 123 dbus_g_object_type_install_info(UPDATE_ENGINE_TYPE_SERVICE,
124 &dbus_glib_update_engine_service_object_info); 124 &dbus_glib_update_engine_service_object_info);
125 UpdateEngineService* service = 125 UpdateEngineService* service =
126 UPDATE_ENGINE_SERVICE(g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL)); 126 UPDATE_ENGINE_SERVICE(g_object_new(UPDATE_ENGINE_TYPE_SERVICE, NULL));
127 service->update_attempter_ = &update_attempter; 127 service->update_attempter_ = &update_attempter;
128 update_attempter.set_dbus_service(service); 128 update_attempter.set_dbus_service(service);
129 chromeos_update_engine::SetupDbusService(service); 129 chromeos_update_engine::SetupDbusService(service);
130 130
131 update_attempter.InitiatePeriodicUpdateChecks(); 131 // Schedule periodic update checks.
132 chromeos_update_engine::UpdateCheckScheduler scheduler(&update_attempter);
133 scheduler.Run();
132 134
133 // Update boot flags after 45 seconds 135 // Update boot flags after 45 seconds
134 g_timeout_add_seconds(45, &chromeos_update_engine::UpdateBootFlags, NULL); 136 g_timeout_add_seconds(45, &chromeos_update_engine::UpdateBootFlags, NULL);
135 137
136 // Run the main loop until exit time: 138 // Run the main loop until exit time:
137 g_main_loop_run(loop); 139 g_main_loop_run(loop);
138 140
139 // Cleanup: 141 // Cleanup:
140 g_main_loop_unref(loop); 142 g_main_loop_unref(loop);
141 update_attempter.set_dbus_service(NULL); 143 update_attempter.set_dbus_service(NULL);
142 g_object_unref(G_OBJECT(service)); 144 g_object_unref(G_OBJECT(service));
143 145
144 LOG(INFO) << "Chrome OS Update Engine terminating"; 146 LOG(INFO) << "Chrome OS Update Engine terminating";
145 return 0; 147 return 0;
146 } 148 }
OLDNEW
« no previous file with comments | « download_action.h ('k') | omaha_request_action.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698