From 81d08ba2e8e3cc1e59ab057953f18119804b9ff9 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Tue, 1 Sep 2015 12:30:17 +0200 Subject: Stop sessions on ReleaseSession --- configure.ac | 2 +- src/login/logind-dbus.c | 2 ++ src/login/logind-session.c | 21 ++++----------------- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 5871ace529..0f004e3584 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ AC_PREREQ([2.64]) # FIXME: Update to proper web page AC_INIT([elogind], - [219.10], + [219.11], [http://bugs.freedesktop.org/enter_bug.cgi?product=elogind], [elogind], [http://www.freedesktop.org/wiki/Software/elogind]) diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 859ad3b58c..5e6952de05 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -837,6 +837,8 @@ static int method_release_session(sd_bus *bus, sd_bus_message *message, void *us if (r < 0) return r; + session_add_to_gc_queue(session); + return sd_bus_reply_method_return(message, NULL); } diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 08ca8072ae..109e3ef133 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -38,8 +38,6 @@ #include "bus-error.h" #include "logind-session.h" -#define RELEASE_USEC (20*USEC_PER_SEC) - static void session_remove_fifo(Session *s); Session* session_new(Manager *m, const char *id) { @@ -599,16 +597,6 @@ int session_finalize(Session *s) { return r; } -static int release_timeout_callback(sd_event_source *es, uint64_t usec, void *userdata) { - Session *s = userdata; - - assert(es); - assert(s); - - session_stop(s, false); - return 0; -} - int session_release(Session *s) { assert(s); @@ -618,11 +606,10 @@ int session_release(Session *s) { if (s->timer_event_source) return 0; - return sd_event_add_time(s->manager->event, - &s->timer_event_source, - CLOCK_MONOTONIC, - now(CLOCK_MONOTONIC) + RELEASE_USEC, 0, - release_timeout_callback, s); + /* In systemd, session release is triggered by user jobs + dying. In elogind we don't have that so go ahead and stop + now. */ + session_stop(s, false); } bool session_is_active(Session *s) { -- cgit v1.2.3-54-g00ecf