summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSoikk2025-10-27 00:38:04 +0100
committerSoikk2025-10-28 19:26:27 +0100
commit5f022ef24f6540cebc739a5d347ca007b0fc4b4c (patch)
tree59fe82682b549596bd951fe8633d2222716fb6f1 /src
parente5f259a3863e8d73c9aa8975bc757579d518963d (diff)
downloadsoikk-server-5f022ef24f6540cebc739a5d347ca007b0fc4b4c.tar.xz
soikk-server-5f022ef24f6540cebc739a5d347ca007b0fc4b4c.tar.zst
Small changes
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main.c6
-rwxr-xr-xsrc/worker.c10
2 files changed, 13 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 8ff8d0e..1c8ff54 100755
--- a/src/main.c
+++ b/src/main.c
@@ -59,12 +59,12 @@ int create_server_dir(str name){
int init(char *configfile){
config = master_config(configfile);
- if(config.name.len == 0){
- log_error("Error: no name for server provided in config");
+ if(config.name.len == 0){ // TODO: maybe check for this someway else
+ log_error("Unable to read config from '%s'", configfile);
return 1;
}
print_master_config(config);
- log_info("Succesfully read config from '%s'", configfile);
+ log_info("Succesfully read master config from '%s'", configfile);
if(create_server_dir(config.name) != 0){
return 1;
}
diff --git a/src/worker.c b/src/worker.c
index 737140d..f4b67c2 100755
--- a/src/worker.c
+++ b/src/worker.c
@@ -107,6 +107,10 @@ void handle_message(ipc_msg im){
int create_server_dir(str name){
dir.path = dup_strs(sstr("/var/run/"), name, sstr("/"));
+ if(!dir_exists(dir.path.ptr)){
+ log_error("No server directory in '%.*s': %s", dir.path.len, dir.path.ptr);
+ return 1;
+ }
dir.ipc_addr = dup_strs(dir.path, sstr("ipcserver"));
str pid = utostr(getpid(), 10);
dir.self = dup_strs(dir.path, sstr("workers/"), pid);
@@ -125,6 +129,12 @@ int create_server_dir(str name){
int init(char *configfile){
config = worker_config(configfile);
+ if(config.name.len == 0){ // TODO: maybe check for this someway else
+ log_error("Unable to read config from '%s'", configfile);
+ return 1;
+ }
+ print_worker_config(config);
+ log_info("Succesfully read worker config from '%s'", configfile);
if(create_server_dir(config.name) != 0){
return 1;
}