mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-05-08 07:48:05 +02:00
Ignore method timeouts when we suspend and hibernate
This commit is contained in:
parent
6b197ebd5e
commit
dccd5fc898
1 changed files with 22 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue