PublicInbox::LeiQuery);
use Getopt::Long ();
use Socket qw(AF_UNIX SOCK_SEQPACKET MSG_EOR pack_sockaddr_un);
-use Errno qw(EPIPE EAGAIN EINTR ECONNREFUSED ENOENT ECONNRESET);
+use Errno qw(EPIPE EAGAIN ECONNREFUSED ENOENT ECONNRESET);
use Cwd qw(getcwd);
use POSIX qw(strftime);
use IO::Handle ();
use Fcntl qw(SEEK_SET);
use PublicInbox::Config;
-use PublicInbox::Syscall qw(EPOLLIN EPOLLET);
+use PublicInbox::Syscall qw(EPOLLIN);
use PublicInbox::DS qw(now dwaitpid);
use PublicInbox::Spawn qw(spawn popen_rd);
use PublicInbox::Lock;
local %ENV = %{$self->{env}};
local $current_lei = $self;
eval {
- my $buf;
- while (my @fds = $recv_cmd->($self->{sock}, $buf, 4096)) {
- if (scalar(@fds) == 1 && !defined($fds[0])) {
- return if $! == EAGAIN;
- next if $! == EINTR;
- last if $! == ECONNRESET;
- die "recvmsg: $!";
- }
- for (@fds) { open my $rfh, '+<&=', $_ }
+ my @fds = $recv_cmd->($self->{sock}, my $buf, 4096);
+ if (scalar(@fds) == 1 && !defined($fds[0])) {
+ return if $! == EAGAIN;
+ die "recvmsg: $!" if $! != ECONNRESET;
}
+ for (@fds) { open my $rfh, '+<&=', $_ }
if ($buf eq '') {
_drop_wq($self); # EOF, client disconnected
dclose($self);
my $sock = $self->{sock} or return;
$self->{-event_init_done} //= do { # persist til $ops done
$sock->blocking(0);
- $self->SUPER::new($sock, EPOLLIN|EPOLLET);
+ $self->SUPER::new($sock, EPOLLIN);
$sock;
};
}
use parent qw(PublicInbox::DS);
use Data::Dumper;
$Data::Dumper::Useqq = 1; # should've been the Perl default :P
-use PublicInbox::Syscall qw(EPOLLIN EPOLLET);
+use PublicInbox::Syscall qw(EPOLLIN);
use PublicInbox::Spawn;
my $recv_cmd;
$r->blocking(0);
no warnings 'once';
$recv_cmd = $PublicInbox::LEI::recv_cmd;
- $self->SUPER::new($r, EPOLLIN|EPOLLET);
+ $self->SUPER::new($r, EPOLLIN);
}
sub event_step {
my ($self) = @_;
- while (1) {
- my (@fds) = $recv_cmd->($self->{sock}, my $buf, 4096 * 33);
- if (scalar(@fds) == 1 && !defined($fds[0])) {
- return if $!{EAGAIN};
- next if $!{EINTR};
- die "recvmsg: $!";
- }
- # open so perl can auto-close them:
- for my $fd (@fds) {
- open(my $newfh, '+<&=', $fd) or die "open +<&=$fd: $!";
- }
- return $self->close if $buf eq '';
- warn Dumper({ 'unexpected self msg' => $buf, fds => \@fds });
- # TODO: figure out what to do with these messages...
+ my (@fds) = $recv_cmd->($self->{sock}, my $buf, 4096 * 33);
+ if (scalar(@fds) == 1 && !defined($fds[0])) {
+ return if $!{EAGAIN};
+ die "recvmsg: $!" unless $!{ECONNRESET};
+ } else { # just in case open so perl can auto-close them:
+ for (@fds) { open my $fh, '+<&=', $_ };
}
+ return $self->close if $buf eq '';
+ warn Dumper({ 'unexpected self msg' => $buf, fds => \@fds });
+ # TODO: figure out what to do with these messages...
}
1;