diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-22 17:05:14 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-22 17:05:14 +0200 |
commit | dc83b9bf92439f0472333dca0bfa1f7edda689b4 (patch) | |
tree | 37a49d270fe9a92ce4c26043f2a1754a867fd07a | |
parent | 80623b9ac9aedce77d27b7c0a54c1b1c245d9279 (diff) |
Add some minor fixes and the beginning of server autostart
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | rcon.c | 1 | ||||
-rw-r--r-- | server-proxy.c | 4 | ||||
-rw-r--r-- | server.h | 10 | ||||
-rw-r--r-- | systemd.c | 2 |
5 files changed, 12 insertions, 6 deletions
@@ -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; @@ -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); @@ -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 { @@ -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; } |