diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-19 19:16:44 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-19 19:16:44 +0200 |
commit | 031b79e3c66de6151dd40cc5067d3fac76e1e7f4 (patch) | |
tree | 241c97eab751aff2f0c08906c889b48d35b4aab3 | |
parent | 91a7ca50f3f8a2c7bb01113fa3849cb5e153a70f (diff) |
Add ome more sanity checks in server, prep work for server states
-rw-r--r-- | server.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -369,6 +369,9 @@ server_start(struct cfg *cfg, struct server *scfg) if (!cfg || !scfg) return false; + if (scfg->task.dead) + return false; + switch (scfg->start_method) { case SERVER_START_METHOD_EXEC: @@ -394,6 +397,9 @@ server_stop(struct cfg *cfg, struct server *scfg) if (!cfg || !scfg) return false; + if (scfg->task.dead) + return false; + switch (scfg->stop_method) { case SERVER_STOP_METHOD_EXEC: @@ -429,6 +435,9 @@ server_commit(struct cfg *cfg, struct server *scfg) return false; } + if (scfg->task.dead) + return false; + if (!list_empty(&scfg->proxys)) { error("%s: proxys not empty?\n", scfg->name); return false; @@ -587,6 +596,9 @@ server_add_remote(struct cfg *cfg, struct server *scfg, struct saddr *remote) if (!scfg || !remote) return false; + if (scfg->task.dead) + return false; + debug(DBG_SRV, "adding remote: %s\n", remote->addrstr); list_add(&remote->list, &scfg->remotes); return true; @@ -602,6 +614,9 @@ server_add_local(struct cfg *cfg, struct server *scfg, struct saddr *saddr) return false; } + if (scfg->task.dead) + return false; + local = zmalloc(sizeof(*local)); if (!local) { error("malloc: %m"); @@ -623,6 +638,9 @@ server_add_rcon(struct cfg *cfg, struct server *scfg, struct saddr *rcon) if (!scfg || !rcon) return false; + if (scfg->task.dead) + return false; + debug(DBG_SRV, "adding rcon: %s\n", rcon->addrstr); list_add(&rcon->list, &scfg->rcons); return true; |