+
+ # don't redispatch into NNTPdeflate::write
+ PublicInbox::DS::write($self, \($_[1]));
+}
+
+sub epwait ($$) {
+ my ($sock, $ev) = @_;
+ epoll_ctl($Epoll, EPOLL_CTL_MOD, fileno($sock), $ev) and
+ confess("EPOLL_CTL_MOD $!");
+}
+
+# return true if complete, false if incomplete (or failure)
+sub accept_tls_step ($) {
+ my ($self) = @_;
+ my $sock = $self->{sock} or return;
+ return 1 if $sock->accept_SSL;
+ return $self->close if $! != EAGAIN;
+ epwait($sock, PublicInbox::TLS::epollbit() | EPOLLONESHOT);
+ unshift(@{$self->{wbuf}}, \&accept_tls_step); # autovivifies
+ 0;
+}
+
+# return true if complete, false if incomplete (or failure)
+sub shutdn_tls_step ($) {
+ my ($self) = @_;
+ my $sock = $self->{sock} or return;
+ return $self->close if $sock->stop_SSL(SSL_fast_shutdown => 1);
+ return $self->close if $! != EAGAIN;
+ epwait($sock, PublicInbox::TLS::epollbit() | EPOLLONESHOT);
+ unshift(@{$self->{wbuf}}, \&shutdn_tls_step); # autovivifies
+ 0;