1 # Copyright all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
4 # dummy placeholder socket for internal lei commands.
5 # This receives what script/lei receives, but isn't connected
6 # to an interactive terminal so I'm not sure what to do with it...
7 package PublicInbox::LeiSelfSocket;
10 use parent qw(PublicInbox::DS);
12 $Data::Dumper::Useqq = 1; # should've been the Perl default :P
13 use PublicInbox::Syscall qw(EPOLLIN);
14 use PublicInbox::Spawn;
19 my $self = bless { sock => $r }, $cls;
22 $recv_cmd = $PublicInbox::LEI::recv_cmd;
23 $self->SUPER::new($r, EPOLLIN);
28 my (@fds) = $recv_cmd->($self->{sock}, my $buf, 4096 * 33);
29 if (scalar(@fds) == 1 && !defined($fds[0])) {
31 die "recvmsg: $!" unless $!{ECONNRESET};
33 } else { # just in case open so perl can auto-close them:
34 for (@fds) { open my $fh, '+<&=', $_ };
36 return $self->close if $buf eq '';
37 warn Dumper({ 'unexpected self msg' => $buf, fds => \@fds });
38 # TODO: figure out what to do with these messages...