]> git.xolatile.top Git - gorillanest.git/commitdiff
Immortality
authorEmil Williams <emilemilemil@cock.li>
Thu, 21 Aug 2025 00:32:48 +0000 (00:32 +0000)
committerEmil Williams <emilemilemil@cock.li>
Thu, 21 Aug 2025 00:32:48 +0000 (00:32 +0000)
config.default.pl
gorillanest.pl.fcgi

index b95d005edbae714c66c65d69929093ad1bac8cb6..9fbc1a2884018b70f619578ca5302128799ffec0 100644 (file)
@@ -1,15 +1,18 @@
-# always assume anything to do with files is from project root
+# always assume anything to do with files or directories is ran at project root
+
+# If you're using lighttpd, set this to 1
+# This disables SOCKET_FILE and lets the socket handling be externally managed
+use constant BARE_REQUEST => 0;
+
+use constant IMMORTAL => 1; # will continue handling request after death/error
 
 use constant LOG_FILE => '/tmp/gorillanest.log';
-use constant SOCKET_FILE => '/tmp/gorillanest.socket';
 use constant DB_FILE => 'gorillanest.sqlite3'; # sqlite3
 
+use constant SOCKET_FILE => '/tmp/gorillanest.socket';
+use constant SOCKET_MAX_CONNECTIONS => 100;
+
 use constant TEMPLATE_ROOT => 'template'; # template directory
 use constant GIT_ROOT => 'git'; # git directory (~user/repo)
 
-# If you're using lighttpd, set this to 1
-# This disables SOCKET_FILE and lets the socket handling be externally managed
-use constant BARE_REQUEST => 0;
-
-use constant SOCKET_MAX_CONNECTIONS => 100;
 1;
index 7dc343f31542aa5f7f3ac1057e4b1659e073c7aa..afba9bee81ce006e26d18347462b3dc864717533 100755 (executable)
@@ -9,12 +9,15 @@ use FCGI;
 use lib '.';
 BEGIN { require 'gorillanest.pl.cgi'; }
 
-try {
-    open STDERR, '>', LOG_FILE or die LOG_FILE . ": $!";
-    my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%ENV, BARE_REQUEST ? 0 : FCGI::OpenSocket(SOCKET_FILE, SOCKET_MAX_CONNECTIONS));
-    while($request->Accept() >= 0) {
-               master();
+while (1) {
+    try {
+        open STDERR, '>', LOG_FILE or die LOG_FILE . ": $!";
+        my $request = FCGI::Request( \*STDIN, \*STDOUT, \*STDERR, \%ENV, BARE_REQUEST ? 0 : FCGI::OpenSocket(SOCKET_FILE, SOCKET_MAX_CONNECTIONS));
+        while($request->Accept() >= 0) {
+            master();
+        }
+    } catch ($error) {
+        info("Crashed: $error");
     }
-} catch ($error) {
-    info("Crashed: $error");
+    exit 1 unless (IMMORTAL);
 }