summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-22 17:05:14 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-22 17:05:14 +0200
commitdc83b9bf92439f0472333dca0bfa1f7edda689b4 (patch)
tree37a49d270fe9a92ce4c26043f2a1754a867fd07a
parent80623b9ac9aedce77d27b7c0a54c1b1c245d9279 (diff)
Add some minor fixes and the beginning of server autostart
-rw-r--r--main.c1
-rw-r--r--rcon.c1
-rw-r--r--server-proxy.c4
-rw-r--r--server.h10
-rw-r--r--systemd.c2
5 files changed, 12 insertions, 6 deletions
diff --git a/main.c b/main.c
index 8b2e37a..6a8ab3a 100644
--- a/main.c
+++ b/main.c
@@ -465,6 +465,7 @@ cfg_init(int argc, char **argv)
if (!debug_category_str[i].name)
usage(argc, argv, true);
+ debug_mask |= DBG_VERBOSE;
debug_mask |= debug_category_str[i].val;
break;
diff --git a/rcon.c b/rcon.c
index 0588da0..ef46d44 100644
--- a/rcon.c
+++ b/rcon.c
@@ -333,6 +333,7 @@ rcon_free(struct uring_task *task)
assert_return(task);
debug(DBG_RCON, "task %p, idle %p", task, rcon);
+ rcon->server->rcon = NULL;
xfree(rcon);
}
diff --git a/server-proxy.c b/server-proxy.c
index 60f4b33..2e8bbd5 100644
--- a/server-proxy.c
+++ b/server-proxy.c
@@ -381,6 +381,10 @@ proxy_new(struct server *server, struct saddr *client, int fd)
uring_task_set_buf(&proxy->servertask, &proxy->serverbuf);
list_add(&proxy->list, &server->proxys);
+ if (server->state != SERVER_STATE_RUNNING) {
+ /* FIXME: We need to wait for the server to start */
+ server_start(server);
+ }
connect_any(&proxy->servertask, &server->remotes,
&proxy->server_conn, proxy_connected_cb);
diff --git a/server.h b/server.h
index e5913ae..223c837 100644
--- a/server.h
+++ b/server.h
@@ -2,11 +2,11 @@
#define fooserverhfoo
enum server_state {
- SERVER_STATE_INIT,
- SERVER_STATE_CFG_OK,
- SERVER_STATE_RUNNING,
- SERVER_STATE_STOPPED,
- SERVER_STATE_DEAD,
+ SERVER_STATE_INIT = 0,
+ SERVER_STATE_CFG_OK = 1,
+ SERVER_STATE_RUNNING = 2,
+ SERVER_STATE_STOPPED = 3,
+ SERVER_STATE_DEAD = 4,
};
enum server_type {
diff --git a/systemd.c b/systemd.c
index c5c62d3..a44b0d8 100644
--- a/systemd.c
+++ b/systemd.c
@@ -135,7 +135,7 @@ systemd_service_running(struct server *server)
server->systemd_service, server->systemd_obj);
out:
- xfree(status);
+ free(status);
sd_bus_error_free(&error);
return running;
}