]> Sergey Matveev's repositories - public-inbox.git/commitdiff
ds: fix return values of do_read and *_tls_step
authorEric Wong <e@80x24.org>
Sun, 30 Jun 2019 05:15:56 +0000 (05:15 +0000)
committerEric Wong <e@80x24.org>
Sun, 30 Jun 2019 05:16:15 +0000 (05:16 +0000)
We need to ensure all these subroutines return false on
incomplete.

lib/PublicInbox/DS.pm

index 57c420634ca42529f8b7c01a29d459723ad5933c..586c47cdc8cef94e05509dfbf0a82136a147f870 100644 (file)
@@ -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