aboutsummaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2021-07-09 09:39:44 +0200
committerLouis Burda <quent.burda@gmail.com>2021-07-09 09:42:49 +0200
commit857e53cf30d17a1fe87b683bb26a54899760dcd8 (patch)
tree08fd67c4243150403a48c376f80272df5f6096f1 /service
parentf9add70b96f8d5e1544547be8feebc9a71f7ece8 (diff)
downloadenowars5-service-stldoctor-857e53cf30d17a1fe87b683bb26a54899760dcd8.tar.gz
enowars5-service-stldoctor-857e53cf30d17a1fe87b683bb26a54899760dcd8.zip
various improvements to logging and performance
added service timeout (180s), improved debug logging, moved persistence checking havocs into single noise by selecting randomly which type of stl to upload (still check correctness of parsing of any type in havocs)
Diffstat (limited to 'service')
-rwxr-xr-xservice/entrypoint.sh2
-rw-r--r--service/src/main.c10
2 files changed, 11 insertions, 1 deletions
diff --git a/service/entrypoint.sh b/service/entrypoint.sh
index 8b6f3e0..61b85e6 100755
--- a/service/entrypoint.sh
+++ b/service/entrypoint.sh
@@ -12,5 +12,5 @@ while [ 1 ]; do
done &
CMD="ncat --keep-open --listen -p 9000 --max-conns 4000 \
---no-shutdown --wait 10s --idle-timeout 180s --exec /service/build/stldoctor"
+--no-shutdown --wait 10s --exec /service/build/stldoctor"
su -s /bin/sh -c "$CMD" service
diff --git a/service/src/main.c b/service/src/main.c
index dd8bca9..c571df9 100644
--- a/service/src/main.c
+++ b/service/src/main.c
@@ -5,6 +5,7 @@
#include <fcntl.h>
#include <time.h>
#include <errno.h>
+#include <signal.h>
#include <sys/stat.h>
#include <sys/file.h>
@@ -454,6 +455,12 @@ cleanexit()
free(resultdir);
}
+void
+timeout()
+{
+ die("time's up!\n");
+}
+
int
main()
{
@@ -461,6 +468,9 @@ main()
int exit, i, cmdlen;
char *cp, *arg;
+ signal(SIGALRM, timeout);
+ alarm(3);
+
if (!(envstr = getenv("RESULTDIR")))
die("RESULTDIR not defined\n");