From 97c346050509758b5d5152f6ff1e0b0f8d871954 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 30 Jun 2019 05:15:56 +0000 Subject: ds: fix return values of do_read and *_tls_step We need to ensure all these subroutines return false on incomplete. --- lib/PublicInbox/DS.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 57c42063..586c47cd 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -440,6 +440,7 @@ sub do_read ($$$;$) { if ($! == EAGAIN) { epwait($sock, epbit($sock, EPOLLIN) | EPOLLONESHOT); rbuf_idle($self, $rbuf); + 0; } else { $self->close; } @@ -559,7 +560,6 @@ sub epwait ($$) { my ($sock, $ev) = @_; epoll_ctl($Epoll, EPOLL_CTL_MOD, fileno($sock), $ev) and confess("EPOLL_CTL_MOD $!"); - 0; } # return true if complete, false if incomplete (or failure) @@ -570,8 +570,10 @@ sub accept_tls_step ($) { return $self->close if $! != EAGAIN; epwait($sock, PublicInbox::TLS::epollbit() | EPOLLONESHOT); unshift @{$self->{wbuf} ||= []}, \&accept_tls_step; + 0; } +# return true if complete, false if incomplete (or failure) sub shutdn_tls_step ($) { my ($self) = @_; my $sock = $self->{sock} or return; @@ -579,6 +581,7 @@ sub shutdn_tls_step ($) { return $self->close if $! != EAGAIN; epwait($sock, PublicInbox::TLS::epollbit() | EPOLLONESHOT); unshift @{$self->{wbuf} ||= []}, \&shutdn_tls_step; + 0; } # don't bother with shutdown($sock, 2), we don't fork+exec w/o CLOEXEC -- cgit v1.2.3-24-ge0c7