]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei: do not access {sock} after SIGPIPE
authorEric Wong <e@80x24.org>
Sat, 30 Oct 2021 08:11:40 +0000 (08:11 +0000)
committerEric Wong <e@80x24.org>
Sat, 30 Oct 2021 18:34:31 +0000 (18:34 +0000)
It's possible for this to break out of the event loop if
note_sigpipe fires via PktOp in the same iteration.

lib/PublicInbox/LEI.pm

index 96f7c5e315a9d4b8b182953cd0a6269db880ca66..78b49a3bc1afca5d837884cf0cf6ac1a24b5fa77 100644 (file)
@@ -1127,7 +1127,7 @@ sub event_step {
        local %ENV = %{$self->{env}};
        local $current_lei = $self;
        eval {
        local %ENV = %{$self->{env}};
        local $current_lei = $self;
        eval {
-               my @fds = $recv_cmd->($self->{sock}, my $buf, 4096);
+               my @fds = $recv_cmd->($self->{sock} // return, my $buf, 4096);
                if (scalar(@fds) == 1 && !defined($fds[0])) {
                        return if $! == EAGAIN;
                        die "recvmsg: $!" if $! != ECONNRESET;
                if (scalar(@fds) == 1 && !defined($fds[0])) {
                        return if $! == EAGAIN;
                        die "recvmsg: $!" if $! != ECONNRESET;