about summary refs log tree commit homepage
path: root/lib/PublicInbox/Daemon.pm
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-03-22 08:58:48 +0000
committerEric Wong <e@yhbt.net>2020-03-24 22:00:25 +0000
commitd7fda3f4b9d4c9e6d01c818f09905d6827fa693f (patch)
treeeff9163fcada3fd086e0f74684422a293ccfdf7e /lib/PublicInbox/Daemon.pm
parentc7acdfe78bda5bf36660a699e882e0e3c431a351 (diff)
downloadpublic-inbox-d7fda3f4b9d4c9e6d01c818f09905d6827fa693f.tar.gz
Disabling workers via `-W0' blesses the contents of the
@listeners array, so we need to ensure we call fcntl on
the GLOB ref in ->{sock}.

Add tests to ensure USR2 works regardless of whether workers
are enabled or not.
Diffstat (limited to 'lib/PublicInbox/Daemon.pm')
-rw-r--r--lib/PublicInbox/Daemon.pm3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index 43ef2691..3d582e35 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -403,6 +403,9 @@ sub upgrade { # $_[0] = signal name or number (unused)
                 $ENV{LISTEN_FDS} = scalar @listeners;
                 $ENV{LISTEN_PID} = $$;
                 foreach my $s (@listeners) {
+                        # @listeners are globs with workers, PI::L w/o workers
+                        $s = $s->{sock} if ref($s) eq 'PublicInbox::Listener';
+
                         my $fl = fcntl($s, F_GETFD, 0);
                         fcntl($s, F_SETFD, $fl &= ~FD_CLOEXEC);
                 }