about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-17 07:19:07 +0000
committerEric Wong <e@80x24.org>2023-01-18 23:26:01 +0000
commit84050272ef72aadbc2fc6abf106a27ff1bb3ddc7 (patch)
tree1c7d1f0d0abe198f0862f33c443e3aa11bb4f4b1
parent710613c1a986ae124202409e67fb3d0b78f5fb43 (diff)
downloadpublic-inbox-84050272ef72aadbc2fc6abf106a27ff1bb3ddc7.tar.gz
The only user of EOFpipe has no args, so avoid wasting a hash
slot on it.  If we need it again in the future, EOFpipe will
allow an array of args, instead.
-rw-r--r--lib/PublicInbox/Daemon.pm2
-rw-r--r--lib/PublicInbox/EOFpipe.pm10
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index ee746f05..17e799ca 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -693,7 +693,7 @@ sub daemon_loop ($) {
         if ($worker_processes > 0) {
                 $refresh->(); # preload by default
                 my $fh = master_loop(); # returns if in child process
-                PublicInbox::EOFpipe->new($fh, \&worker_quit, undef);
+                PublicInbox::EOFpipe->new($fh, \&worker_quit);
         } else {
                 reopen_logs();
                 $set_user->() if $set_user;
diff --git a/lib/PublicInbox/EOFpipe.pm b/lib/PublicInbox/EOFpipe.pm
index e537e2aa..628e9366 100644
--- a/lib/PublicInbox/EOFpipe.pm
+++ b/lib/PublicInbox/EOFpipe.pm
@@ -1,14 +1,14 @@
-# Copyright (C) 2020-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 
 package PublicInbox::EOFpipe;
-use strict;
+use v5.12;
 use parent qw(PublicInbox::DS);
 use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT);
 
 sub new {
-        my (undef, $rd, $cb, $arg) = @_;
-        my $self = bless {  cb => $cb, arg => $arg }, __PACKAGE__;
+        my (undef, $rd, $cb) = @_;
+        my $self = bless { cb => $cb }, __PACKAGE__;
         # 1031: F_SETPIPE_SZ, 4096: page size
         fcntl($rd, 1031, 4096) if $^O eq 'linux';
         $self->SUPER::new($rd, EPOLLIN|EPOLLONESHOT);
@@ -17,7 +17,7 @@ sub new {
 sub event_step {
         my ($self) = @_;
         if ($self->do_read(my $buf, 1) == 0) { # auto-closed
-                $self->{cb}->($self->{arg});
+                $self->{cb}->();
         }
 }