diff options
author | Eric Wong <e@80x24.org> | 2023-11-02 21:35:50 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2023-11-03 06:39:25 +0000 |
commit | e85d3280129ce60a9587895a44df765a39447634 (patch) | |
tree | cc202f6acbb9341e7c6ac5bb054a24980d6e2fdb /lib/PublicInbox/DS.pm | |
parent | db47ea523760f7ceef3d38c0008e082e9e7d1c02 (diff) | |
download | public-inbox-e85d3280129ce60a9587895a44df765a39447634.tar.gz |
ds: don't try ->close after ->accept_SSL failure
Eric Wong <e@80x24.org> wrote: > --- a/lib/PublicInbox/DS.pm > +++ b/lib/PublicInbox/DS.pm > @@ -341,8 +341,8 @@ sub greet { > my $ev = EPOLLIN; > my $wbuf; > if ($sock->can('accept_SSL') && !$sock->accept_SSL) { > - return CORE::close($sock) if $! != EAGAIN; > - $ev = PublicInbox::TLS::epollbit() or return CORE::close($sock); > + return $sock->close if $! != EAGAIN; > + $ev = PublicInbox::TLS::epollbit() or return $sock->close; > $wbuf = [ \&accept_tls_step, $self->can('do_greet')]; > } > new($self, $sock, $ev | EPOLLONESHOT); Noticed this on deploy: -----8<----- Subject: [PATCH] ds: don't try ->close after ->accept_SSL failure ->accept_SSL failures leaves the socket ref as a GLOB (not IO::Handle) and unable to respond to the ->close method. Calling close in any form isn't actually necessary at all, so just let refcounting destroy the socket.
Diffstat (limited to 'lib/PublicInbox/DS.pm')
-rw-r--r-- | lib/PublicInbox/DS.pm | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/PublicInbox/DS.pm b/lib/PublicInbox/DS.pm index 33f80087..da26efc4 100644 --- a/lib/PublicInbox/DS.pm +++ b/lib/PublicInbox/DS.pm @@ -341,8 +341,7 @@ sub greet { my $ev = EPOLLIN; my $wbuf; if ($sock->can('accept_SSL') && !$sock->accept_SSL) { - return $sock->close if $! != EAGAIN; - $ev = PublicInbox::TLS::epollbit() or return $sock->close; + return if $! != EAGAIN || !($ev = PublicInbox::TLS::epollbit()); $wbuf = [ \&accept_tls_step, $self->can('do_greet')]; } new($self, $sock, $ev | EPOLLONESHOT); |