write_pid($pid_file);
# for ->DESTROY:
- bless { pid => $$, pid_file => $pid_file }, __PACKAGE__;
+ bless { pid => $$, pid_file => \$pid_file }, __PACKAGE__;
}
sub worker_quit { # $_[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);
}
WINCH => 'IGNORE',
CHLD => \&PublicInbox::DS::enqueue_reap,
};
- my $parent_pipe;
if ($worker_processes > 0) {
$refresh->(); # preload by default
my $fh = master_loop(); # returns if in child process
- $parent_pipe = PublicInbox::ParentPipe->new($fh, *worker_quit);
+ PublicInbox::ParentPipe->new($fh, \&worker_quit);
} else {
reopen_logs();
$set_user->() if $set_user;
}
sub DESTROY {
- unlink_pid_file_safe_ish($_[0]->{pid}, $_[0]->{pid_file});
+ unlink_pid_file_safe_ish($_[0]->{pid}, ${$_[0]->{pid_file}});
}
1;