use Errno qw(EAGAIN);
my $pipelineq = [];
-my $pipet;
sub process_pipelineq () {
my $q = $pipelineq;
- $pipet = undef;
$pipelineq = [];
foreach (@$q) {
next unless $_->{sock};
sub new ($$$) {
my ($class, $sock, $addr, $httpd) = @_;
my $self = fields::new($class);
- $self->SUPER::new($sock, EPOLLIN | EPOLLONESHOT);
+ my $ev = EPOLLIN;
+ my $wbuf;
+ if (ref($sock) eq 'IO::Socket::SSL' && !$sock->accept_SSL) {
+ return CORE::close($sock) if $! != EAGAIN;
+ $ev = PublicInbox::TLS::epollbit();
+ $wbuf = [ \&PublicInbox::DS::accept_tls_step ];
+ }
+ $self->SUPER::new($sock, $ev | EPOLLONESHOT);
$self->{httpd} = $httpd;
+ $self->{wbuf} = $wbuf if $wbuf;
($self->{remote_addr}, $self->{remote_port}) =
PublicInbox::Daemon::host_with_port($addr);
$self;
my ($self) = @_;
if ($self->{rbuf}) {
# avoid recursion for pipelined requests
+ PublicInbox::DS::requeue(\&process_pipelineq) if !@$pipelineq;
push @$pipelineq, $self;
- $pipet ||= PublicInbox::EvCleanup::asap(*process_pipelineq);
} else { # wait for next request
$self->requeue;
}
if ($self->{wbuf}) {
$self->write($next);
} else {
- PublicInbox::EvCleanup::asap($next);
+ PublicInbox::DS::requeue($next);
}
return;
}
($self->{rbuf} || $self->{env} || $self->{wbuf});
}
-# fires after pending writes are complete:
-sub restart_pass ($) {
- $_[0]->{forward}->restart_read; # see PublicInbox::HTTPD::Async
-}
-
-sub enqueue_restart_pass ($) { $_[0]->write(\&restart_pass) }
-
1;