summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/server.c b/server.c
index 3f7a7bf..8f5cd7d 100644
--- a/server.c
+++ b/server.c
@@ -382,8 +382,7 @@ server_start(struct cfg *cfg, struct server *server)
if (!cfg || !server)
return false;
- if (server->task.dead)
- return false;
+ assert_task_alive_or(DBG_SRV, &server->task, return false);
switch (server->start_method) {
@@ -415,8 +414,7 @@ server_stop(struct cfg *cfg, struct server *server)
if (!cfg || !server)
return false;
- if (server->task.dead)
- return false;
+ assert_task_alive_or(DBG_SRV, &server->task, return false);
switch (server->stop_method) {
@@ -457,8 +455,7 @@ server_commit(struct cfg *cfg, struct server *server)
return false;
}
- if (server->task.dead)
- return false;
+ assert_task_alive_or(DBG_SRV, &server->task, return false);
if (server->state != SERVER_STATE_INIT) {
error("called in wrong state");
@@ -620,8 +617,7 @@ server_add_remote(struct cfg *cfg, struct server *server, struct saddr *remote)
if (!server || !remote)
return false;
- if (server->task.dead)
- return false;
+ assert_task_alive_or(DBG_SRV, &server->task, return false);
debug(DBG_SRV, "adding remote: %s", remote->addrstr);
list_add(&remote->list, &server->remotes);
@@ -638,8 +634,7 @@ server_add_local(struct cfg *cfg, struct server *server, struct saddr *saddr)
return false;
}
- if (server->task.dead)
- return false;
+ assert_task_alive_or(DBG_SRV, &server->task, return false);
local = zmalloc(sizeof(*local));
if (!local) {
@@ -662,8 +657,7 @@ server_add_rcon(struct cfg *cfg, struct server *server, struct saddr *rcon)
if (!server || !rcon)
return false;
- if (server->task.dead)
- return false;
+ assert_task_alive_or(DBG_SRV, &server->task, return false);
debug(DBG_SRV, "adding rcon: %s", rcon->addrstr);
list_add(&rcon->list, &server->rcons);