[gnome-session] manager: restart user bus if last graphical session
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-session] manager: restart user bus if last graphical session
- Date: Wed, 19 Jul 2017 16:45:29 +0000 (UTC)
commit 97d1cf5360c0bbf213c8037918c7b14582e7791d
Author: Ray Strode <rstrode redhat com>
Date: Wed Jul 19 10:43:04 2017 -0400
manager: restart user bus if last graphical session
There are desktop services (such as goa-daemon, e-d-s, etc)
that don't open the display, but rely on dbus-daemon to scope
the session. These days dbus-daemon is a user bus, not a sesssion,
bus which leaves these services alive after log out.
This commit checks to see if we're the last desktop session for the
user at log out time, and if so, restarts the dbus daemon. This
will lead to existing clients getting booted and die, but allow user
bus clients that want to outlive a session to stick around if they so
desire.
Longer term, clients should stop relying on the session bus to define
their lifetime.
https://bugzilla.gnome.org/show_bug.cgi?id=764029
gnome-session/gsm-manager.c | 38 ++++++++++++++++++++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index 012f3d3..bdba38e 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -935,6 +935,40 @@ _client_stop (const char *id,
return FALSE;
}
+#ifdef HAVE_SYSTEMD
+static void
+maybe_restart_user_bus (GsmManager *manager)
+{
+ GsmSystem *system;
+ g_autoptr(GVariant) reply = NULL;
+ g_autoptr(GError) error = NULL;
+
+ if (manager->priv->dbus_disconnected)
+ return;
+
+ system = gsm_get_system ();
+
+ if (!gsm_system_is_last_session_for_user (system))
+ return;
+
+ reply = g_dbus_connection_call_sync (manager->priv->connection,
+ "org.freedesktop.systemd1",
+ "/org/freedesktop/systemd1",
+ "org.freedesktop.systemd1.Manager",
+ "TryRestartUnit",
+ g_variant_new ("(ss)", "dbus.service", "replace"),
+ NULL,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+
+ if (error != NULL) {
+ g_debug ("GsmManager: reloading user bus failed: %s", error->message);
+ }
+}
+#endif
+
static void
do_phase_exit (GsmManager *manager)
{
@@ -944,6 +978,10 @@ do_phase_exit (GsmManager *manager)
NULL);
}
+#ifdef HAVE_SYSTEMD
+ maybe_restart_user_bus (manager);
+#endif
+
end_phase (manager);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]