chiark / gitweb /
Stop sessions on ReleaseSession
authorSven Eden <yamakuzure@gmx.net>
Wed, 8 Feb 2017 06:50:07 +0000 (07:50 +0100)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:23:13 +0000 (10:23 +0100)
src/login/logind-dbus.c
src/login/logind-session.c

index ef0c13b..ede9282 100644 (file)
@@ -860,6 +860,8 @@ static int method_release_session(sd_bus_message *message, void *userdata, sd_bu
         if (r < 0)
                 return r;
 
+        session_add_to_gc_queue(session);
+
         return sd_bus_reply_method_return(message, NULL);
 }
 
index 1a35671..b5e4bee 100644 (file)
@@ -40,7 +40,7 @@
 #include "formats-util.h"
 #include "terminal-util.h"
 
-#define RELEASE_USEC (20*USEC_PER_SEC)
+// #define RELEASE_USEC (20*USEC_PER_SEC)
 
 static void session_remove_fifo(Session *s);
 
@@ -726,6 +726,8 @@ int session_finalize(Session *s) {
         return 0;
 }
 
+/// UNNEEDED by elogind
+#if 0
 static int release_timeout_callback(sd_event_source *es, uint64_t usec, void *userdata) {
         Session *s = userdata;
 
@@ -735,6 +737,7 @@ static int release_timeout_callback(sd_event_source *es, uint64_t usec, void *us
         session_stop(s, false);
         return 0;
 }
+#endif // 0
 
 int session_release(Session *s) {
         assert(s);
@@ -745,11 +748,19 @@ int session_release(Session *s) {
         if (s->timer_event_source)
                 return 0;
 
+        /* In systemd, session release is triggered by user jobs
+           dying.  In elogind we don't have that so go ahead and stop
+           now.  */
+#if 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);
+
+#else
+        return session_stop(s, false);
+#endif // 0
 }
 
 bool session_is_active(Session *s) {