summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2009-04-25 11:07:30 +0100
committerRichard Hughes <richard@hughsie.com>2009-04-25 11:07:30 +0100
commitdccd5fc898bcb3d66038902cfddeb9ea935f5a18 (patch)
tree5a2033c8655136cf40b1e207c694e7c861b936a6
parent6b197ebd5e0f914071a03f5e3da21e9045df12bc (diff)
downloadupower-dccd5fc898bcb3d66038902cfddeb9ea935f5a18.tar.gz
Ignore method timeouts when we suspend and hibernate
-rw-r--r--devkit-power-gobject/dkp-client.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/devkit-power-gobject/dkp-client.c b/devkit-power-gobject/dkp-client.c
index 045c6d7..859a8be 100644
--- a/devkit-power-gobject/dkp-client.c
+++ b/devkit-power-gobject/dkp-client.c
@@ -137,11 +137,21 @@ dkp_client_suspend (DkpClient *client, GError **error)
ret = dbus_g_proxy_call (client->priv->proxy, "Suspend", &error_local,
G_TYPE_INVALID, G_TYPE_INVALID);
if (!ret) {
+ /* DBus might time out, which is okay */
+ if (g_error_matches (error_local, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) {
+ g_debug ("DBUS timed out, but recovering");
+ ret = TRUE;
+ goto out;
+ }
+
+ /* an actual error */
g_warning ("Couldn't suspend: %s", error_local->message);
if (error != NULL)
*error = g_error_new (1, 0, "%s", error_local->message);
- g_error_free (error_local);
}
+out:
+ if (error_local != NULL)
+ g_error_free (error_local);
return ret;
}
@@ -160,11 +170,21 @@ dkp_client_hibernate (DkpClient *client, GError **error)
ret = dbus_g_proxy_call (client->priv->proxy, "Hibernate", &error_local,
G_TYPE_INVALID, G_TYPE_INVALID);
if (!ret) {
+ /* DBus might time out, which is okay */
+ if (g_error_matches (error_local, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) {
+ g_debug ("DBUS timed out, but recovering");
+ ret = TRUE;
+ goto out;
+ }
+
+ /* an actual error */
g_warning ("Couldn't hibernate: %s", error_local->message);
if (error != NULL)
*error = g_error_new (1, 0, "%s", error_local->message);
- g_error_free (error_local);
}
+out:
+ if (error_local != NULL)
+ g_error_free (error_local);
return ret;
}