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 EPOLLET);
14 use PublicInbox::Spawn;
19 my $self = bless { sock => $r }, $cls;
22 $recv_cmd = $PublicInbox::LEI::recv_cmd;
23 $self->SUPER::new($r, EPOLLIN|EPOLLET);
29 my (@fds) = $recv_cmd->($self->{sock}, my $buf, 4096 * 33);
30 if (scalar(@fds) == 1 && !defined($fds[0])) {
35 # open so perl can auto-close them:
37 open(my $newfh, '+<&=', $fd) or die "open +<&=$fd: $!";
39 return $self->close if $buf eq '';
40 warn Dumper({ 'unexpected self msg' => $buf, fds => \@fds });
41 # TODO: figure out what to do with these messages...