about summary refs log tree commit homepage
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/public-inbox-httpd6
1 files changed, 4 insertions, 2 deletions
diff --git a/script/public-inbox-httpd b/script/public-inbox-httpd
index b31b896d..7b0ec560 100755
--- a/script/public-inbox-httpd
+++ b/script/public-inbox-httpd
@@ -4,6 +4,7 @@
 #
 # Standalone HTTP server for public-inbox.
 use strict;
+use v5.10.1;
 use PublicInbox::Daemon;
 BEGIN {
         for (qw(Plack::Builder Plack::Util)) {
@@ -14,7 +15,7 @@ BEGIN {
         require PublicInbox::HTTPD;
 }
 
-my %httpds;
+my %httpds; # per-listen-FD mapping for HTTPD->{env}->{SERVER_<NAME|PORT>}
 my $app;
 my $refresh = sub {
         if (@ARGV) {
@@ -37,12 +38,13 @@ my $refresh = sub {
                         sub { $www->call(@_) };
                 };
         }
+        %httpds = (); # invalidate cache
 };
 
 PublicInbox::Daemon::run('0.0.0.0:8080', $refresh,
         sub ($$$) { # post_accept
                 my ($client, $addr, $srv) = @_;
                 my $fd = fileno($srv);
-                my $h = $httpds{$fd} ||= PublicInbox::HTTPD->new($srv, $app);
+                my $h = $httpds{$fd} //= PublicInbox::HTTPD->new($srv, $app);
                 PublicInbox::HTTP->new($client, $addr, $h),
         });