return r;
}
-int user_stop(User *u) {
+int user_stop(User *u, bool force) {
Session *s;
int r = 0, k;
assert(u);
+ /* Stop jobs have already been queued */
+ if (u->stopping) {
+ user_save(u);
+ return r;
+ }
+
LIST_FOREACH(sessions_by_user, s, u->sessions) {
- k = session_stop(s);
+ k = session_stop(s, force);
if (k < 0)
r = k;
}
bool all_closing = true;
LIST_FOREACH(sessions_by_user, i, u->sessions) {
- if (session_is_active(i))
+ SessionState state;
+
+ state = session_get_state(i);
+ if (state == SESSION_ACTIVE)
return USER_ACTIVE;
- if (session_get_state(i) != SESSION_CLOSING)
+ if (state != SESSION_CLOSING)
all_closing = false;
}