return idle_hint;
}
-int seat_check_gc(Seat *s) {
+int seat_check_gc(Seat *s, bool drop_not_started) {
assert(s);
- if (!s->started)
+ if (drop_not_started && !s->started)
return 0;
if (seat_is_vtconsole(s))
int seat_stop(Seat *s);
int seat_stop_sessions(Seat *s);
-int seat_check_gc(Seat *s);
+int seat_check_gc(Seat *s, bool drop_not_started);
void seat_add_to_gc_queue(Seat *s);
bool seat_name_is_valid(const char *name);
}
}
-int session_check_gc(Session *s) {
+int session_check_gc(Session *s, bool drop_not_started) {
int r;
assert(s);
- if (!s->started)
+ if (drop_not_started && !s->started)
return 0;
if (s->fifo_fd >= 0) {
Session *session_new(Manager *m, User *u, const char *id);
void session_free(Session *s);
-int session_check_gc(Session *s);
+int session_check_gc(Session *s, bool drop_not_started);
void session_add_to_gc_queue(Session *s);
int session_activate(Session *s);
bool session_is_active(Session *s);
return idle_hint;
}
-int user_check_gc(User *u) {
+int user_check_gc(User *u, bool drop_not_started) {
int r;
char *p;
assert(u);
- if (!u->started)
+ if (drop_not_started && !u->started)
return 0;
if (u->sessions)
User* user_new(Manager *m, uid_t uid, gid_t gid, const char *name);
void user_free(User *u);
-int user_check_gc(User *u);
+int user_check_gc(User *u, bool drop_not_started);
void user_add_to_gc_queue(User *u);
int user_start(User *u);
int user_stop(User *u);
return 0;
}
-void manager_gc(Manager *m) {
+void manager_gc(Manager *m, bool drop_not_started) {
Seat *seat;
Session *session;
User *user;
LIST_REMOVE(Seat, gc_queue, m->seat_gc_queue, seat);
seat->in_gc_queue = false;
- if (seat_check_gc(seat) == 0) {
+ if (seat_check_gc(seat, drop_not_started) == 0) {
seat_stop(seat);
seat_free(seat);
}
LIST_REMOVE(Session, gc_queue, m->session_gc_queue, session);
session->in_gc_queue = false;
- if (session_check_gc(session) == 0) {
+ if (session_check_gc(session, drop_not_started) == 0) {
session_stop(session);
session_free(session);
}
LIST_REMOVE(User, gc_queue, m->user_gc_queue, user);
user->in_gc_queue = false;
- if (user_check_gc(user) == 0) {
+ if (user_check_gc(user, drop_not_started) == 0) {
user_stop(user);
user_free(user);
}
manager_enumerate_users(m);
manager_enumerate_sessions(m);
+ /* Remove stale objects before we start them */
+ manager_gc(m, false);
+
/* And start everything */
HASHMAP_FOREACH(seat, m->seats, i)
seat_start(seat);
struct epoll_event event;
int n;
- manager_gc(m);
+ manager_gc(m, true);
if (dbus_connection_dispatch(m->bus) != DBUS_DISPATCH_COMPLETE)
continue;
- manager_gc(m);
+ manager_gc(m, true);
n = epoll_wait(m->epoll_fd, &event, 1, -1);
if (n < 0) {
void manager_cgroup_notify_empty(Manager *m, const char *cgroup);
-void manager_gc(Manager *m);
+void manager_gc(Manager *m, bool drop_not_started);
int manager_get_idle_hint(Manager *m, dual_timestamp *t);