From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id E6B2F1FB05 for ; Tue, 26 Oct 2021 10:35:58 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 9/9] input_pipe: account for undefined {sock} Date: Tue, 26 Oct 2021 10:35:57 +0000 Message-Id: <20211026103557.2738-10-e@80x24.org> In-Reply-To: <20211026103557.2738-1-e@80x24.org> References: <20211026103557.2738-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It's possible for ->event_step to fire twice due to ->requeue with EPOLLET (but not EPOLLONESHOT). So account for that and avoid causing event loop errors as a result. --- lib/PublicInbox/InputPipe.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PublicInbox/InputPipe.pm b/lib/PublicInbox/InputPipe.pm index 00813a0701b1..e1e26e20b9d2 100644 --- a/lib/PublicInbox/InputPipe.pm +++ b/lib/PublicInbox/InputPipe.pm @@ -18,7 +18,7 @@ sub consume { sub event_step { my ($self) = @_; - my $r = sysread($self->{sock}, my $rbuf, 65536); + my $r = sysread($self->{sock} // return, my $rbuf, 65536); if ($r) { $self->{cb}->(@{$self->{args} // []}, $rbuf); return $self->requeue; # may be regular file or pipe