From 708f431db8dab6779dd090a1117e556340eca9cc Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Sun, 12 Jul 2020 22:46:47 +0200 Subject: Some minor fixes, in particular, don't free scfg too early --- minecproxy/server-proxy.c | 2 +- minecproxy/server.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'minecproxy') diff --git a/minecproxy/server-proxy.c b/minecproxy/server-proxy.c index d357396..056d0c5 100644 --- a/minecproxy/server-proxy.c +++ b/minecproxy/server-proxy.c @@ -517,7 +517,7 @@ bool local_open(struct server_local *local) socket_set_low_latency(sfd, cfg->socket_keepalive, cfg->socket_iptos, cfg->socket_nodelay); - verbose("%s: attempting to bind to %s", local->server->scfg.name, + verbose("%s: listening to %s", local->server->scfg.name, local->local.addrstr); r = bind(sfd, (struct sockaddr *)&local->local.st, local->local.addrlen); diff --git a/minecproxy/server.c b/minecproxy/server.c index 7e6aa84..258dfa8 100644 --- a/minecproxy/server.c +++ b/minecproxy/server.c @@ -47,6 +47,7 @@ static void server_free(struct uring_task *task) assert_return(task); debug(DBG_SRV, "freeing server (%p)", server); + scfg_delete(&server->scfg); list_del(&server->list); xfree(server); } @@ -74,7 +75,7 @@ void server_delete(struct server *server) uring_task_put(&server->exec_task); uring_task_destroy(&server->task); uring_task_put(&server->ann_task); - scfg_delete(&server->scfg); + scfg_cancel_adns(&server->scfg); } void server_delete_by_filename(const char *filename) @@ -230,13 +231,15 @@ static bool server_check_running(struct server *server) /* FIXME: other methods, rcon? */ if (server->scfg.systemd_service) { - verbose("%s: checking if systemd service is running", - server->scfg.name); if (systemd_service_running(&server->scfg, &error)) { server->state = SERVER_STATE_RUNNING; + verbose("%s: systemd service is running", + server->scfg.name); return true; } else { server->state = SERVER_STATE_STOPPED; + verbose("%s: systemd service is not running", + server->scfg.name); return false; } } -- cgit v1.2.3