AU: Ensure update_engine_client get proxy retries are spaced out in time.
Hopefully, this will reduce test flakyness. It seems that last time the test
failed all 4 tries happened within a one-second timeframe.
Also, fix GError object memory leaks throughout the code.
BUG=chromium-os:21351
TEST=unit tests, tested on VM
Change-Id: If0bc5d5767d12f3396d0fcb46f3e04ed6d7dfd5c
Reviewed-on: http://gerrit.chromium.org/gerrit/8862
Commit-Ready: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
diff --git a/main.cc b/main.cc
index b96add3..fd84e50 100644
--- a/main.cc
+++ b/main.cc
@@ -58,9 +58,8 @@
GError *error = NULL;
bus = dbus_g_bus_get(DBUS_BUS_SYSTEM, &error);
- if (!bus) {
- LOG(FATAL) << "Failed to get bus";
- }
+ LOG_IF(FATAL, !bus) << "Failed to get bus: "
+ << utils::GetAndFreeGError(&error);
proxy = dbus_g_proxy_new_for_name(bus,
DBUS_SERVICE_DBUS,
DBUS_PATH_DBUS,
@@ -71,11 +70,10 @@
0,
&request_name_ret,
&error)) {
- LOG(FATAL) << "Failed to get name: " << error->message;
+ LOG(FATAL) << "Failed to get name: " << utils::GetAndFreeGError(&error);
}
if (request_name_ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
g_warning("Got result code %u from requesting name", request_name_ret);
- g_error_free(error);
LOG(FATAL) << "Got result code " << request_name_ret
<< " from requesting name, but expected "
<< DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER;