Ignore method timeouts when we suspend and hibernate

This commit is contained in:
Richard Hughes 2009-04-25 11:07:30 +01:00
parent 6b197ebd5e
commit dccd5fc898

View file

@ -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;
}