return 0;
}
-bool machine_check_gc(Machine *m, bool drop_not_started) {
+bool machine_may_gc(Machine *m, bool drop_not_started) {
assert(m);
if (m->class == MACHINE_HOST)
- return true;
+ return false;
if (drop_not_started && !m->started)
- return false;
+ return true;
if (m->scope_job && manager_job_is_active(m->manager, m->scope_job))
- return true;
+ return false;
if (m->unit && manager_unit_is_active(m->manager, m->unit))
- return true;
+ return false;
- return false;
+ return true;
}
void machine_add_to_gc_queue(Machine *m) {
Machine* machine_new(Manager *manager, MachineClass class, const char *name);
void machine_free(Machine *m);
-bool machine_check_gc(Machine *m, bool drop_not_started);
+bool machine_may_gc(Machine *m, bool drop_not_started);
void machine_add_to_gc_queue(Machine *m);
int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error);
int machine_stop(Machine *m);
machine->in_gc_queue = false;
/* First, if we are not closing yet, initiate stopping */
- if (!machine_check_gc(machine, drop_not_started) &&
+ if (machine_may_gc(machine, drop_not_started) &&
machine_get_state(machine) != MACHINE_CLOSING)
machine_stop(machine);
/* Now, the stop probably made this referenced
* again, but if it didn't, then it's time to let it
* go entirely. */
- if (!machine_check_gc(machine, drop_not_started)) {
+ if (machine_may_gc(machine, drop_not_started)) {
machine_finalize(machine);
machine_free(machine);
}