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/utils.cc b/utils.cc
index bcf34d5..5273347 100644
--- a/utils.cc
+++ b/utils.cc
@@ -518,10 +518,17 @@
return true;
}
-const char* GetGErrorMessage(const GError* error) {
- if (!error)
- return "Unknown error.";
- return error->message;
+string GetAndFreeGError(GError** error) {
+ if (!*error) {
+ return "Unknown GLib error.";
+ }
+ string message =
+ base::StringPrintf("GError(%d): %s",
+ (*error)->code,
+ (*error)->message ? (*error)->message : "(unknown)");
+ g_error_free(*error);
+ *error = NULL;
+ return message;
}
bool Reboot() {