summaryrefslogtreecommitdiff
path: root/minecproxy
diff options
context:
space:
mode:
Diffstat (limited to 'minecproxy')
-rw-r--r--minecproxy/misc.c2
-rw-r--r--minecproxy/server-config.c80
2 files changed, 3 insertions, 79 deletions
diff --git a/minecproxy/misc.c b/minecproxy/misc.c
index f954618..152de1a 100644
--- a/minecproxy/misc.c
+++ b/minecproxy/misc.c
@@ -250,7 +250,7 @@ again:
sfd = socket(conn->remote.storage.ss_family, SOCK_STREAM | SOCK_CLOEXEC, 0);
if (sfd < 0) {
- error("socket: %m");
+ debug(DBG_SRV, "socket: %m");
goto again;
}
diff --git a/minecproxy/server-config.c b/minecproxy/server-config.c
index 549cf16..4e16155 100644
--- a/minecproxy/server-config.c
+++ b/minecproxy/server-config.c
@@ -15,6 +15,7 @@
#include "config-parser.h"
#include "server.h"
#include "server-config.h"
+#include "server-config-options.h"
static void
scfg_dns_cb(struct dns_async *dns, bool (*server_cb)(struct server *, struct saddr *))
@@ -108,83 +109,6 @@ scfg_rcon_dns_cb(struct dns_async *dns)
scfg_dns_cb(dns, server_add_rcon);
}
-enum scfg_keys {
- SCFG_KEY_INVALID = 0,
- SCFG_KEY_TYPE,
- SCFG_KEY_NAME,
- SCFG_KEY_PORT,
- SCFG_KEY_LOCAL,
- SCFG_KEY_REMOTE,
- SCFG_KEY_IDLE_TIMEOUT,
- SCFG_KEY_STOP_METHOD,
- SCFG_KEY_START_METHOD,
- SCFG_KEY_STOP_EXEC,
- SCFG_KEY_START_EXEC,
- SCFG_KEY_RCON,
- SCFG_KEY_RCON_PASSWORD,
- SCFG_KEY_SYSTEMD_SERVICE,
-};
-
-struct cfg_key_value_map scfg_key_map[] = {
- {
- .key_name = "type",
- .key_value = SCFG_KEY_TYPE,
- .value_type = CFG_VAL_TYPE_STRING,
- }, {
- .key_name = "name",
- .key_value = SCFG_KEY_NAME,
- .value_type = CFG_VAL_TYPE_STRING,
- }, {
- .key_name = "port",
- .key_value = SCFG_KEY_PORT,
- .value_type = CFG_VAL_TYPE_UINT16,
- }, {
- .key_name = "local",
- .key_value = SCFG_KEY_LOCAL,
- .value_type = CFG_VAL_TYPE_ASYNC_ADDRS,
- }, {
- .key_name = "remote",
- .key_value = SCFG_KEY_REMOTE,
- .value_type = CFG_VAL_TYPE_ASYNC_ADDRS,
- }, {
- .key_name = "idle_timeout",
- .key_value = SCFG_KEY_IDLE_TIMEOUT,
- .value_type = CFG_VAL_TYPE_UINT16,
- }, {
- .key_name = "stop_method",
- .key_value = SCFG_KEY_STOP_METHOD,
- .value_type = CFG_VAL_TYPE_STRING,
- }, {
- .key_name = "start_method",
- .key_value = SCFG_KEY_START_METHOD,
- .value_type = CFG_VAL_TYPE_STRING,
- }, {
- .key_name = "stop_exec",
- .key_value = SCFG_KEY_STOP_EXEC,
- .value_type = CFG_VAL_TYPE_STRING,
- }, {
- .key_name = "start_exec",
- .key_value = SCFG_KEY_START_EXEC,
- .value_type = CFG_VAL_TYPE_STRING,
- }, {
- .key_name = "rcon",
- .key_value = SCFG_KEY_RCON,
- .value_type = CFG_VAL_TYPE_ASYNC_ADDRS,
- }, {
- .key_name = "rcon_password",
- .key_value = SCFG_KEY_RCON_PASSWORD,
- .value_type = CFG_VAL_TYPE_STRING,
- }, {
- .key_name = "systemd_service",
- .key_value = SCFG_KEY_SYSTEMD_SERVICE,
- .value_type = CFG_VAL_TYPE_STRING,
- }, {
- .key_name = NULL,
- .key_value = SCFG_KEY_INVALID,
- .value_type = CFG_VAL_TYPE_INVALID,
- }
-};
-
static bool
handle_dns(struct server *server, const char *type,
struct cfg_value *value, dns_cb_t *async_cb,
@@ -230,7 +154,7 @@ scfg_parse(struct server *server)
pos = server->tbuf.buf;
- if (!config_parse_header(server->name, "server", &pos))
+ if (!config_parse_header(server->name, SERVER_CFG_HEADER, &pos))
return;
while (true) {