diff options
Diffstat (limited to 'lib/PublicInbox')
-rw-r--r-- | lib/PublicInbox/IPC.pm | 11 | ||||
-rw-r--r-- | lib/PublicInbox/LEI.pm | 7 | ||||
-rw-r--r-- | lib/PublicInbox/LeiToMail.pm | 7 | ||||
-rw-r--r-- | lib/PublicInbox/LeiXSearch.pm | 5 |
4 files changed, 9 insertions, 21 deletions
diff --git a/lib/PublicInbox/IPC.pm b/lib/PublicInbox/IPC.pm index 592efd21..c52441f7 100644 --- a/lib/PublicInbox/IPC.pm +++ b/lib/PublicInbox/IPC.pm @@ -46,11 +46,6 @@ my $send_cmd = PublicInbox::Spawn->can('send_cmd4') // do { PublicInbox::CmdIPC4->can('send_cmd4'); }; -sub wq_set_recv_modes { - my ($self, @modes) = @_; - $self->{-wq_recv_modes} = \@modes; -} - sub _get_rec ($) { my ($r) = @_; defined(my $len = <$r>) or return; @@ -251,15 +246,13 @@ sub _recv_and_run { my ($self, $s2, $len, $full_stream) = @_; my @fds = $recv_cmd->($s2, my $buf, $len); my $n = length($buf // '') or return; - my @m = @{$self->{-wq_recv_modes} // [qw( +<&= >&= >&= )]}; my $nfd = 0; for my $fd (@fds) { - my $mode = shift(@m); - if (open(my $cmdfh, $mode, $fd)) { + if (open(my $cmdfh, '+<&=', $fd)) { $self->{$nfd++} = $cmdfh; $cmdfh->autoflush(1); } else { - die "$$ open($mode$fd) (FD:$nfd): $!"; + die "$$ open(+<&=$fd) (FD:$nfd): $!"; } } while ($full_stream && $n < $len) { diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index a9123c6e..473a28a9 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -765,11 +765,10 @@ sub accept_dispatch { # Listener {post_accept} callback return send($sock, 'timed out waiting to recv FDs', MSG_EOR); my @fds = $recv_cmd->($sock, my $buf, 4096 * 33); # >MAX_ARG_STRLEN if (scalar(@fds) == 4) { - my $i = 0; - for my $rdr (qw(<&= >&= >&= <&=)) { + for my $i (0..3) { my $fd = shift(@fds); - open($self->{$i++}, $rdr, $fd) and next; - send($sock, "open($rdr$fd) (FD=$i): $!", MSG_EOR); + open($self->{$i}, '+<&=', $fd) and next; + send($sock, "open(+<&=$fd) (FD=$i): $!", MSG_EOR); } } else { return send($sock, "recv_cmd failed: $!", MSG_EOR); diff --git a/lib/PublicInbox/LeiToMail.pm b/lib/PublicInbox/LeiToMail.pm index 5f38add1..08a1570d 100644 --- a/lib/PublicInbox/LeiToMail.pm +++ b/lib/PublicInbox/LeiToMail.pm @@ -227,9 +227,7 @@ sub decompress_src ($$$) { sub dup_src ($) { my ($in) = @_; - # fileno needed because wq_set_recv_modes only used ">&=" for {1} - # and Perl blindly trusts that to reject the '+' (readability flag) - open my $dup, '+>>&=', fileno($in) or die "dup: $!"; + open my $dup, '+>>&', $in or die "dup: $!"; $dup; } @@ -475,8 +473,7 @@ sub write_mail { # via ->wq_do sub ipc_atfork_prepare { my ($self) = @_; - # (done_wr, stdout|mbox, stderr, 3: sock, 4: each_smsg_done_wr) - $self->wq_set_recv_modes(qw[+<&= >&= >&= +<&= >&=]); + # FDs: (done_wr, stdout|mbox, stderr, 3: sock, 4: each_smsg_done_wr) $self->SUPER::ipc_atfork_prepare; # PublicInbox::IPC } diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm index 1c093a94..c396c597 100644 --- a/lib/PublicInbox/LeiXSearch.pm +++ b/lib/PublicInbox/LeiXSearch.pm @@ -389,9 +389,8 @@ sub ipc_atfork_prepare { require PublicInbox::MboxReader; require IO::Uncompress::Gunzip; } - # (0: done_wr, 1: stdout|mbox, 2: stderr, - # 3: sock, 4: $l2m->{-wq_s1}, 5: $startq) - $self->wq_set_recv_modes(qw[+<&= >&= >&= +<&= +<&= <&=]); + # FDS: (0: done_wr, 1: stdout|mbox, 2: stderr, + # 3: sock, 4: $l2m->{-wq_s1}, 5: $startq) $self->SUPER::ipc_atfork_prepare; # PublicInbox::IPC } |