summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-20 15:16:14 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-20 15:16:14 +0200
commit0721128bcce0790663e1491d8684edaf918874b6 (patch)
tree1b6fcb0c58301c0a889b146fd32c6dc37f13135d
parent9da3a20a0b58374618d8723d7c961dd45491ba13 (diff)
Use assert_task_alive in server.c as well
-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);